CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Help: Interface with a PCM3500 voice codec

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
FoxtrotMike



Joined: 31 May 2007
Posts: 11

View user's profile Send private message

Help: Interface with a PCM3500 voice codec
PostPosted: Mon Jun 25, 2007 2:57 pm     Reply with quote

Hi:

·I want to interface a PCM3500 voice codec with a PIC, in order to store digitized voice in a PC via the UART, and then play it back. This chip has on board 16 bits ADC and DAC, and a synchronous serial port with 4 lines: FS (frame sync), BCK (bit clock), DIN (serial data in), DOUT (serial data out).

·The problem is that a frame is 16 bits long, containing a full conversion result, and i don't know how to make the PIC read that. I thought of using the SPI port, but the SPI_WRITE and SPI_READ functions are intended to work with 8 bits registers, so it seems it's not possible to read or write 16 bits at once.

·About the timing, it depends on the sampling frequency; each frame lasts Tf = 1/Fs, and each bit lasts Tb = 1/(16*Fs). For example, at 8 [kHz], each frame last 125 [us], and each bit lasts 7.8 [us].

·This chip can be be both slave and master; the frame sync pin can be used as an input (slave) or input (master). A frame sync signal is a pulse with a duration of Tb, and it repeats every Tf.

·I guess it's possible to do the transmission by bit banging, and the reception by using an external interrupt, but it seems a little messy, so if there's a better way to do it, please let me know about it.

·By the way, i'm using a PIC18F252 with a 20 [MHz] xtal. If anyone can give me a hand, i'll be grateful.

Best regards,
Fernando
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Wed Jul 11, 2007 2:42 pm     Reply with quote

Not sure which version you are using, but in PCWH latest revisions, there is spi_xfer(), which allows you to define the number of bits to transfer. This would be a software SPI port, which is slower and would tie up the application while it is operating, but is a way you could do it. Otherwise, you may have to roll out your own SPI read/write functions.
Best of luck.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group