Anda di halaman 1dari 4

Interfacing a Texas Instruments PCM1725 Digital to Analog Converter (DAC) to a PIC16 6!

"
I've recently become interested in adding sound to some microcontroller projects, and decided to use the PCM1725 manu actured by !e"as Instruments# !his chip is relatively cheap and comes in a $%IC pac&age, 'hich, 'hile not as convenient as a (IP, is much easier to 'or& 'ith than an $$%P# !his project is a minimalist approach and does not provide C( )uality audio due to the lo' sampling rate, but I believe it is enough to sho' the concepts involved 'ith ma&ing the PCM1725 'or&# !his project only includes three integrated circuits* a !I PCM1725 digital to analog converter that produces audio rom binary data, an +tmel +!25(,-.1+ memory chip to hold the binary sound ile, and a Microchip PIC1/,/0- that controls the other chips# I used the internal cloc& on the 1/,/0- running at 1Mh2 'ith cloc&out on the 3+. pin, 'hich provides the system cloc& or the PCM1725 at 2Mh2# !hus, the sampling rate is limited to around 7,1-- samples4sec# since the system cloc& must be 25/ or 51. times the sampling re)uency# !he PCM1725 re)uires the ollo'ing inputs* system cloc& at 25/ or 51. times the sampling re)uency, 6e t43ight cloc& that cloc&s in the data or the le t and right channels at one cycle per sample 71425/th or 1451.th the system cloc& re)uency8, bit cloc& that cloc&s in the binary data one bit at a time 7though the datasheet is silent on the re)uency, it should be /. cycles per sample, or 52 bits per channel per sample8, and the binary audio data# 9ach o these e"cept or the binary audio data is provided by the 1/,/0-# !he binary in ormation is delivered rom the memory chip directly# !he pins o the chips are mapped as ollo's* Pic 3C7 : Memory Chip $I Pic 3;/ : Memory Chip $C< and PCM1725 ;C<I= Pic 3C. : Memory Chip Chip $elect Pic 3;7 : PCM1725 63CI= Pic 3+. : PCM1725 $C<I Memory chip $I : PCM1725 (I= ,ollo'ing is a very nonpro essional schematic o the 'ay I 'ired it up#

=ote that I tied the ormat pin to ground in order to use standard data entry ormatting instead# $o here is ho' it 'or&s# !he PIC1/,/0- initiates a read command on the memory chip, 'hich already has the audio data loaded# ,or the +!25(,-.1+, this is done by cloc&ing in the 1 byte 3ead command 7>5> in binary8 ollo'ed by the three address bytes, 'hich are all -'s or my application since I 'ant to start 'ith the irst byte# ,ollo'ing the read command, the memory chip places the irst bit o in ormation on the $% pin 7all in ormation is cloc&ed out on the do'n cycle o the data cloc&8# !he 3;7 pin on the PIC1/,/0- is pulled high to begin cloc&ing in the le t channel data 763CI= pin on the PCM17258# +ll subse)uent cycles o the 3;/ pin on the 1/,/0- cloc& in data into the PCM1725 on the ups'ing and retrieve the ne"t bit rom the memory chip on the do'ns'ing# ,ollo'ing 52 cycles o 3;/, 3;7 is pulled do'n to cloc& in the le t channel byte in ormation that 'as just entered and start entering the right channel in ormation in

the same manner# + ter 52 bits have been entered, the 3;7 pin 763CI= on the PCM17258 is pulled high to cloc& in the right channel in ormation and start entering the ne"t sample# Clic& here or the irm'are, 'ritten in ?i:!ech C or the PIC 1/,/0%ne note on the ormatting o the audio ile on the memory chip# !he data must be entered M$; ist 7;ig 9ndian8, 'hich means that the bytes must be reversed i you are using a #'av ile, since they are entered in 6ittle 9ndian orm# $ee this page or more in ormation on the #'av 7@+A98 ile ormat# +lso, since the PCM1725 is only 1/ bit, you must ma&e sure that the 1/ bits o data are the last 1/ bits cloc&ed in prior to changing the state o the 63CI= pin i you are using the $tandard data entry ormat# I thin& you can accomplish this by using the ?%6( eature on the memory chip, but I handled it by adding t'o -'s to each sample so that the originally 1/:bit data becomes 52 bit data 7i#e#, 252 17 becomes - - 252 178# !his ensures that the 1/ bits o audio data are cloc&ed in during the last 1/ cycles o ;C<I=, as speci ied in the PCM1725 datasheet# +lso, note that i you start 'ith a #'av ile that has only one channel 7mono vs# stereo8, you need to load each sample t'ice onto the memory chip : one each or the le t and right channel# +gain, this is a very basic application and not great audio since this sampling re)uency is belo' the minimum speci ied in the PCM1725 datasheet# ?o'ever, this should at least get you started# I believe you could use a binary counter attached directly to the cloc& source to handle the bit cloc& and 63CI= unctions 73;/ and 3;7 on the PIC 1/,/0-8# !hough this 'as 'ritten speci ically or the PCM1725, I thin& the same principles can be used or the ther !e"as Instrumet (+C chips, including PCM1705, PCM1710, PCM177., PCM171-, PCM1711, PCM1712, PCM1701, PCM170/, PCM1775, PCM1772, PCM1771, PCM177-, PCM17.1, PCM17.2, PCM17.1, PCM17.-, PCM17.., PCM1727, PCM170., PCM1705, PCM1702, PCM1701, PCM1755, PCM175., and PCM1755# Ma#e sure $ou c%ec# out m$ &ro'ects( B$; $erial Communication using the Microchip MCP22-- : Inter acing microcontrollers 'ith a computer using this cheap chip# Inter acing a PCM1725 to a PIC1/,/0- : +dding audio to a project by inter acing a PCM1725 (+C to a PIC1/,/0-# Bsing the +vago +(=$:2/1- $ensor : Programming an optical sensor rom an optical mouse# B$; Communications using the PIC11,.55- : Programming a microcontroller to communicate 'ith a computer via the B$; port Inter acing to Microcontrollers to $( Cards : +ccessing iles stored on $( Cards in ,+!1/ ormat via the $PI module in a microcontroller ;uilding 9lectronic (rums : ?o' to construct electronic drums using pie2o sensors Circuit +rchive : I you are loo&ing or other sample circuits or various uses and components, this is the place or you#

Component 6ist : I you are loo&ing or suppliers or di erent project components, I've compiled some good ones here# Any questions or comments - contact me at pwclark1977@hotmail.com

Anda mungkin juga menyukai