Other Parts Discussed in Thread: ADS7844
HI all
We are using ADS7844E in our application through SPI interface but it is not working properly?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Other Parts Discussed in Thread: ADS7844
HI all
We are using ADS7844E in our application through SPI interface but it is not working properly?
Hi shridhar
Thank you for the reply. we interfaced ADS7844E with PIC Microcontroller through SPI. We are able to see the data reaching upto the ADC pin. we are writing 0x97 for the second channel but data we are getting is constant despite we varied through potentiometer.
Please find the attachment and our code below.
void InitSPI()
{
SPI2CON1bits.DISSCK = 0; //Internal Serial Clock is Enabled.
SPI2CON1bits.DISSDO = 0; //SDOx pin is controlled by the module.
SPI2CON1bits.MODE16 = 1; //Communication is byte-wide (8 bits).
SPI2CON1bits.SMP=0; //Input Data is sampled at middle of data output time.
//Serial output data changes on transition from idle clock state to active clock state
SPI2CON1bits.CKE = 0;
//Idle state for clock is a low level; active state is a high level
SPI2CON1bits.CKP = 1;
SPI2CON1bits.SSEN=0; //SSx Pin not used by the module
SPI2CON1bits.MSTEN = 1; //Master Mode enabled
SPI2CON1bits.SPRE=0b001; //Secondary prescalar is 4:1 //FCY is 20MHz
SPI2CON1bits.PPRE=0b11; //Primary prescalar is 1:1
SPI2CON2bits.FRMEN=0; //Framed SPI support is disabled
SPI2STATbits.SPIEN=1; //Enable SPI Module
SPI2STATbits.SPISIDL=0; //Continue Module operation in idle mode
SPI2STATbits.SPIROV=0; //Receive overflow flag is cleared
}
unsigned int SPI_Recieve(void)
{
SPI2STATbits.SPIRBF=0;
SPI2BUF=0x00;
while(!SPI2STATbits.SPIRBF);
return SPI2BUF;
}
void SPI_Send(unsigned char Data)
{
SPI2BUF=Data;
while(SPI2STATbits.SPITBF);
while(!SPI2STATbits.SPIRBF);
Data=SPI2BUF;
}
main(){
char ControlByte, Start;
int Data;
while(1){
//ch 0 = current. ch 1 = feedback. ch 2 = voltage
Start = 0x87;
ExternalADC_CS = 0;
ControlByte = Start | (channel << 4);
SPI_Send(ControlByte);
// Delayus(500);
Data = SPI_Recieve();
ExternalADC_CS = 1;
}
}
Hi shridhar
we noticed that data out from ADC is not changing(always constant) with respect to change in input.
Hi shridhar
we tried all four possibility with CPOL & CPHA (00,01,10,11) but we are not getting expected output.
Hi shridhar
Please let me know what kind of information do you required? This is our prototype design it has to go for production in may. we have to freeze the design as early as possible.
for your above query
we are getting 4.97V at VCC and 4.99V at Vref