Dears,
I am using a ADS8688IDBTR with Arduino zero it works with the code below, but every time i upload the code the channel number changes for each channel :
#include "SPI.h"
int CS=A3;
float ch =0;
void setup() {
pinMode(CS, OUTPUT);
digitalWrite(CS, 1);
SPI.begin();
SPI.setDataMode(SPI_MODE1);
SPI.setBitOrder(MSBFIRST);
SerialUSB.begin(9600);
Serial.begin(9600);
digitalWrite(CS, 1);
}
void loop() {
for(int i =0 ; i<8 ;i++){
digitalWrite(CS, 0);
SPI.transfer16(0x00); // start Ch0 sampling
ch=SPI.transfer16(0x00); // get Ch0 conversion
digitalWrite(CS, 1);
ch=mapfloat(ch,32770,65535,0,10.15);
SerialUSB.print("CH");
SerialUSB.print(i) ;
SerialUSB.print(" = ") ;
SerialUSB.println(ch) ;
delay(10);
}
delay(1000);
}
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
I tried to use this lib but it wont work ::https://github.com/siteswapjuggler/ADS8688a
can any body help in this case and if there is any c++ code fit with this IC and Arduino zero
i want to know also the registers command order to initialize it before read channels