Dear tinkeres,
I have a problem of understanding of the following CN0391 evaluation board. I have it currently hooked up to the Teensy3.6
and I dont get a feedback from the AD7124 on the evaluation board(ADC). it produces jitter on the MOSI, MISO line.
I am greatly lacking in the SPI department, and looking for some help. I posted the Screenshot from the OScilloscope to check on the CLK, MOSI,MISO,CS as you can see.
also I get a -1 value on my serial Monitor.
I just dont have a clue where to look. ill start with the SPI commands in the setup and change those as given by the PJRC community.
the following code that is being used is:
I have a problem of understanding of the following CN0391 evaluation board. I have it currently hooked up to the Teensy3.6
and I dont get a feedback from the AD7124 on the evaluation board(ADC). it produces jitter on the MOSI, MISO line.
I am greatly lacking in the SPI department, and looking for some help. I posted the Screenshot from the OScilloscope to check on the CLK, MOSI,MISO,CS as you can see.
also I get a -1 value on my serial Monitor.
I just dont have a clue where to look. ill start with the SPI commands in the setup and change those as given by the PJRC community.
the following code that is being used is:
Code:
#include <ad7124.h>
/* constants ================================================================ */
const int ledPin = 9;
const int ssPin = 10;
/* public variables ========================================================= */
Ad7124Chip adc;
/* internal public functions ================================================ */
// -----------------------------------------------------------------------------
void setup() {
//Initialize serial and wait for port to open:
Serial.begin (38400);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// prints title with ending line break
Serial.println ("AD7124 Voltmeter");
// Initializes the AD7124 device, the pin /CS is pin 10 (/SS)
adc.begin (ssPin);
// Setting the configuration 0:
// - use of the internal reference voltage 2.5V
// - gain of 1 for a bipolar measurement +/- 2.5V
adc.setConfig (0, Ad7124::RefInternal, Ad7124::Pga1, true);
// Setting channel 0 using pins AIN1(+)/AIN0(-)
adc.setChannel (0, 0, Ad7124::AIN1Input, Ad7124::AIN0Input);
// Configuring ADC in Full Power Mode (Fastest)
adc.setAdcControl (Ad7124::StandbyMode, Ad7124::FullPower, true);
}
// -----------------------------------------------------------------------------
void loop() {
long value;
double voltage;
// Measuring Voltage on Channel 0 in Single Conversion Mode
digitalWrite (ledPin, 10);
value = adc.read (ssPin);
Serial.print("value ");
Serial.println(value);
digitalWrite (ledPin, 10);
if (value >= 0) {
// If the measurement is successful, the value is converted into voltage
voltage = Ad7124Chip::toVoltage (value, 1, 2.5, true);
// Print result
Serial.println (voltage, 3);
}
else {
Serial.println ("FAIL");
}
}