asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Sun Oct 06, 2013 7:51 pm |
|
|
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!! |
|