Hi,
For ADAR7251, I have written the register value via SPI. The processor i used was BF548. I want to read the output from ADAR7251. But i am not getting the output from ADAR7251. The following is the code i have written for reading.
PG2(Port G)--->CONV_START
PC4(Port C)--->DATA_READY
PC7(Port C)--->DATA_SCLK
PC8,PC9,PC10,PC11(Port C)---->DOUT
void Init_ADC_PORT(void)
{
int clk_len=15;
*pPORTG_FER = 0x0000; // set PORTG to GPIO mode
*pPORTG_DIR_SET = PG2 | PG1; //Set as output pin
*pPORTG_INEN = 0x0000; // enable as output
*pPORTG_CLEAR = 0x0000;
*pPORTG_MUX = 0x0000;
*pPORTC_FER = 0x0000; // set PORTC to GPIO mode
*pPORTC_DIR_SET = PC4 | PC7 ; //Set as output pin
*pPORTC_INEN = PC8 | PC9 | PC10 | PC11 ; // enable as input
*pPORTC_CLEAR = 0x0000;
*pPORTC_MUX = 0x0000;
*pPORTG = *pPORTG | (1 << 2); // CONV_START=1
*pPORTC = *pPORTC & ~ (1 << 4); //DATA_READY=0
*pPORTG = *pPORTG & ~ (1 << 2); // CONV_START=0
*pPORTC = *pPORTC | (1 << 4); //DATA_READY=1
while(clk_len>=0)
{
*pPORTC = *pPORTC & ~ (1 << 7); //DATA_SCLK=0
*pPORTC = *pPORTC | (1 << 7); //DATA_SCLK=1
// printf("%u\t%u\t%u\t%u\n",(*pPORTC >> 8) & 1,(*pPORTC >> 9) & 1,(*pPORTC >> 10) & 1,(*pPORTC >> 11) & 1);
clk_len--;
}
*pPORTC = *pPORTC & ~ (1 << 7); //DATA_SCLK=0
}
when i check with the oscilloscope i am not able to read.
What may be the problem?
Thanks.