Other Parts Discussed in Thread: ADS7066
Hello,
we would like to evaluate the ADS9224R. Unfortunately there is no support for C code or is there anything in the meantime.
We have first designed standard functions for SPI. Next we would read and write registers.
According to the datasheet we first have to send a command READ or Write with address and data.
We implemented this function as follows:
void vSendCommand(char cOPCode, char cAddr, char cData) { int CodeToTransfer = 0, digit; volatile bool myBit = false; SPI_CS_Low; SPI_CONVST_High; CodeToTransfer = (cOPCode << 12) | (cAddr << 8) | cData; digit = 0; do{ myBit = CHECKBIT(CodeToTransfer,digit); _NOP(); if (myBit){ SPI_SDI_High; //SDA high } else { SPI_SDI_Low; //SDA low } SPI_SCK_High; //Clock high SPI_SCK_Low; //Clock low _NOP(); }while(++digit < 16); SPI_CONVST_Low; SPI_CS_High; _NOP(); }
Is this correct so far?
Now we would like to read the data from the corresponding register. How do we do that. We had thought of a function "unsigned char ucRegisterData()".
In that we monitor the RDY pin and as soon as the data is ready we would read it. Unfortunately we are stuck here. How do we get the data of the corresponding register.
It would be nice if someone could help us with C code example to jump the first hurdle.