#include <SPI.h> // Call of libraries
#include <AD7193.h>
AD7193 AD7193; // Creation of the object AD7193
unsigned long valeur;
float tension;
void setup()
{
Serial.begin(9600); // initialization of serial communication
Init_AD7193();
}
void loop()
{
valeur = AD7193.ReadADCChannel(1); // conversion A/N on input 1
valeur = valeur >> 8; // Extraction of value , raw data
tension = AD7193.DataToVoltage(valeur); // Recovery of tension
//Serial.println("");
//Serial.print("Digital Value = ");
//Serial.print(valeur,BIN);
Serial.print('\t'); // tabulation
//Serial.print(" ");
Serial.println(tension,5);
//delay(1);
}
// Initialisation of module Pmod AD5
void Init_AD7193(void)
{
AD7193.begin(); // initialization of P mod AD5 module
AD7193.AppendStatusValuetoData(); // configuration of P mod AD5 module
AD7193.SetPGAGain(1);
AD7193.SetAveraging(1);
AD7193.Calibrate();
AD7193.SetRegisterValue(AD7193_REG_MODE,0x80001,4,1); // set the throughput to 4.7KHz
//AD7193.GetRegisterValue(AD7193_REG_MODE,4,1);
AD7193.ReadRegisterMap(); //Debugging
}
this is the my latest version of code
i am printing the data on serial monitor in order to log in using another software called CoolTerm ,
i will try to use any other method to log data if this is slowing down the things, please let me know how can i log data using any other method than this!
thanks
AD7193.cpp (10.1 KB)
AD7193.h (2.68 KB)