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 CCS Technical Support

ADC to SPI communication
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sun Oct 06, 2013 7:51 pm     Reply with quote

temtronic wrote:
After looking at the SPI datasheet...it seems you'll have 'fun' trying to read in 16 bits of data into the 8 bit SPI peripheral.It naturally would require 2 operations and doesn't appear to be 'programmer friendly'.
I still don't see how the ADC is a real 'SPI' device,more a 3 wire device.
Honestly, if you're stuck using this ADC, consider the old school 'bit banging' approach.
Use the ADC's FSO pin to trigger an interrupt.Inside the ISR read the DOUT pin while counting SCLK transitions, building up a 16 bit variable.
This approach will work and should maybe take 2-3 hours to get it 'up and running'.Once you're OK with the data coming back, then _maybe_ see if you can get the internal SPI of the PIC to work.

It boils down to how much time you have for this 'driver' section of code or the overall project.

hth
jay


I have not used this specific A/D however I do not believe it is a difficult task.

Frame mode is not required. This PIC supports both 8 and 16 bit SPI modes therefore fitting 16 bits into an 8 bit peripheral is not relevant to this PIC. Having said that, this A/D would work perfectly fine with the PIC's SPI in 8 bit mode or talking to an 8 bit PIC. A PIC limited to an 8 bit mode serial peripheral or this PIC configured in 8 bit mode would simply see two sequential bytes of data coming in and the SPI would resync on the next FC0 transition.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
BM92



Joined: 04 Oct 2013
Posts: 18

View user's profile Send private message

PostPosted: Tue Oct 22, 2013 7:37 am     Reply with quote

Thanks for all the help and advice. I managed to get the PIC and ADC to work. It turned out to be a relatively simple piece of code to initialize it. I do however have another question.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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