trying to communicate arduino with AD7792 which is a 16-bit ADC via SPI
however keep getting '0's in the serial monitor
any help would be appreciated
code looks like this:
#include <SPI.h>
const int CS = 10;//define chip select pin on Nano 33 BLE Sense
const byte readDeviceID = 0b01100000; //read command for ADC communicator
byte deviceID;//8-bit register size
void setup() {
Serial.begin(9600);
while (!Serial);
pinMode(CS, OUTPUT);
digitalWrite(CS, HIGH);
SPI.begin();
}
void loop() {
SPI.beginTransaction(SPISettings(64000, MSBFIRST, SPI_MODE3));//ADC has internal 64kHz clock,SCK idle high,clock phase1
digitalWrite(CS, LOW);
SPI.transfer(readDeviceID); // Write to the communicator to read ID register
deviceID = SPI.transfer(0); // get ID register value
digitalWrite(CS, HIGH);
SPI.endTransaction();
Serial.println(deviceID,BIN);
delay(1000);
}
details of AD7792 can be found here: https://www.analog.com/media/en/technical-documentation/data-sheets/AD7792_7793.pdf