Hi!
I tried to interface a 12 bit ADC with the SPI port on my TS7200.
However, whenever I try to read all 8 channels, four of them send the
value of the voltage present on pin 1 (ADC0) and the other 4 (5
through 8) send the value on pin 5 (ADC4).
In order to access a particular channel I used the following algorithm
adapted from 2 sources:
spi_init();
bring CS up
for(i ...){
bring CS down;
write ((i>3)?0x07:0x06) //start,diff/single, D2
(http://www.swisstech.ca/Projects/Home%20Automation/ADC_Functions.h)
delay;
write (i*0x40) //D1,D0
(http://www.swisstech.ca/Projects/Home%20Automation/ADC_Functions.h)
delay;
value [i] = read_data_spi; //upper part of the result
write (0x55);
delay;
value [i] = value [i] +read_data_spi; //add the lower part of the result
bring CS up;
Could you tell me what I did wrong? Has someone in this group used
this particular ADC? The datasheet of MCP3208 is located here:
http://ww1.microchip.com/downloads/en/DeviceDoc/21298D.pdf
Thank you in advance,
Razvan
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|