I am having difficulty connecting to an AD7731 24 bit ADC on the SPI bus. I am not completely familliar with the SPI communication.
In the application notes, this pseudo code is given:
Write 03 Hex to Serial Port 1
Write 1332 Hex to Serial Port 1
Write 02 Hex to Serial Port1
Write B174 Hex to Serial Port1
Wait for RDY Low
Write 02 Hex to Serial Port1
Write 9174 Hex to Serial Port1
Wait for RDY Low
As I read the SPI notes for the arduino and other SPI examples, I think it should be:
digitalWrite(_cs,LOW);
SPI.transfer(0x03);
digitalWrite(_cs,HIGH);
digitalWrite(_cs,LOW);
SPI.transfer(0x13);
SPI.transfer(0x32);
digitalWrite(_cs,HIGH);
digitalWrite(_cs,LOW);
SPI.transfer(0x02);
digitalWrite(_cs,HIGH);
digitalWrite(_cs,LOW);
SPI.transfer(0xB1);
SPI.transfer(0x74);
digitalWrite(_cs,HIGH);
delay(1000); // wait a second as we are not looking at the RDY pin
digitalWrite(_cs,LOW);
SPI.transfer(0x02);
digitalWrite(_cs,HIGH);
digitalWrite(_cs,LOW);
SPI.transfer(0x91);
SPI.transfer(0x74);
digitalWrite(_cs,HIGH);
delay(1000); // ditto no RDY pin
Can anyone confirm that I have this correct? Do I need to go hi then low again before every sent command?
Keith