i am using ads7828 adc. when i put millis() and observed it take 1ms delay in reading. How can i make faster.
my sample code:
// .ino file
entry_tim = millis();
read_value = adc.read(0, SD);
exit_tim = millis();
time_ = exit_tim - entry_tim;
Serial.println(time_);
// ads7828 library
unsigned int ADS7828::read(unsigned char channel, bool mode)
{
unsigned long reading = 0;
Wire.beginTransmission(ads_address);
Wire.write(0x84);
Wire.endTransmission();
Wire.requestFrom(ads_address, 2); // Request 2 bytes from the ADC
if(2 <= Wire.available())
{
reading = Wire.read(); // receive high byte
reading = reading << 8; // shift high byte to be high 8 bits
reading |= Wire.read(); // receive low byte into lower 8 bits
}
return reading;// return the full 12 bits reading from the ADC channel
}
Is it possible to reduce time by changing anything inside wire.requestfrom , wire.read functions