Page 1 of 1

MCP3202 and XC8 problem

PostPosted: Thu Jun 04, 2015 7:21 pm
by Claudione
Hi Guys.

I got a problem using MCP3202 , the circuit use a pic18F 3 DA and one MCP41010 and finally the MCP3202 , all devices are working properly , the SPI line is ok ,however MCP3202 wont work , i show strange value . Here is my code :

unsigned int getADC(unsigned char channel) { // Returns 0..4095

unsigned int ch=0;
unsigned int datahigh,datalow;
CSD = 1;
if(channel==0){ch=0xA0;}else{ch=0xE0;}
OpenSPI(SPI_FOSC_64, MODE_00, SMPEND);
CSD = 0;
WriteSPI(0x01);
WriteSPI(ch);
datahigh = ReadSPI();
WriteSPI(0x00);
datalow = ReadSPI();
CSD = 1;
return ((datahigh << 8) | datalow);
}

Someone can help me ?

Re: MCP3202 and XC8 problem

PostPosted: Fri Jun 05, 2015 3:30 am
by ric
Please don't ask the same question in multiple forums.
Continue in your other topic at viewtopic.php?f=45&t=222