CONTENTS

Home
Updates
Software
Electronics
Music
Resume
Contact


YouTube
Twitter
GitHub
LinkedIn


DAC Sound Player

Date Posted: June 22, 2009

Introduction

Just a simple project to play digital sound using an Atmel ATtiny2313. This project demonstrates a few things: 1) reading digital sound data from a Microchip 24LC256 using an i2c bus connected to an Atmel ATtiny2313 2) using a TI TLC7524 parallel DAC chip 3) using the LM386 as an amplifier.

Update: I made a similar project just recently using a 12 bit SPI DAC and an SD/MMC card. I posted that project here: SD/MMC Sound

Related Projects @mikekohn.net

Related pages on www.mikekohn.net: MSP43F169 Guitar Proc, MSP430G2231 Guitar Proc, 6581 Sound Chip, Floppy Music, Metal X Mod, YJM Mod, DAC Sound, SD/MMC, MSP430 Assembler

Pictures

ATtin2313, 24LC256, and TI TLC7524 audio circuit

Texas Instruments TLC7524 DAC

I found this chip on DigiKey while looking for an 8 bit parallel DAC. Since I like Texas Instruments parts a lot I picked this one. Unfortunately the documentation was absolutely horrible. Infact, this is was some of the worst TI documentation I've ever seen. First of all, they didn't have a chart labeling exactly what each pin did. Then they gave sample circuits showing how to use the thing with an opamp to make voltages between -Vref and +Vref or 0 to -Vref which neither was something I wanted. I wanted 0 to +Vref. Looking online I found other people who had used the same chip got 0 to +Vref by using an opamp as an inverter, which means there has to be a negative voltage source in the circuit, which means extra circuitry I didn't want to do. After fiddling with this chip for a couple hours and reading page 5 of the datasheet more, I realized that what they called "voltage mode" (what a horrible name.. isn't the whole chip in some kind of voltage mode??) meant that I can get an output from 0 to an input voltage based on a reference and the data pins by hooking the whole thing up backwards! So the Ref pin is my output pin, OUT2 goes to ground, and OUT1 is my refence voltage. Now I get digital input on the data pins and an output between 0 and 5 volts on Ref depending on the data pins' digital value. An opamp can amplify this to something that can be played on a little speaker. Great. Good job TI for making a nice chip but making it a pain to learn how to use it.

Microchip 24LC256

This is my first time programming 2wire (some i2c compatible thing) from a microcontroller to an eeprom chip. I used this chip because I already had a circuit (I thought) from my Propeller Poker project. I basically just took the circuit from the schematic from Parallax. Unfortunately, they didn't use a pullup resistor on the SCL clock line and I didn't find any talk about it in the chip's datasheet. The ATtiny2313 docs did talk about a pullup, but I figured if the Microchip datasheet didn't talk about it and the Parallax circuit didn't use it and it worked there, that I didn't need it. I thought wrong and wasted a lot of time trying to get 2wire working without it. Lesson learned.

Schematic
ATtin2313, 24LC256, and TI TLC7524 audio schematic

Source code
dac_player.asm

Copyright 1997-2024 - Michael Kohn