Skip to content

getBusRaw()

Arnd edited this page Dec 12, 2020 · 2 revisions

getBusRaw([deviceNumber]);

This function returns the raw register value from the INA devices specified. Each INA2xx has a defined LSB for bus accuracy (typically 1.25 mV) and this would need to be applied to the raw value in order to convert it to a voltage reading. If the system mode is set to triggered measurements rather than continuous ones (see setMode() for details) then the next measurement cycle is triggered by this read.

This value is directly read from the INA2xx registers and is not affected by the settings for calibration given in the begin() function call.


Example:

INA_Class INA(); // Instantiate the class
void setup() {
  uint8_t deviceCount = INA.begin(10,100000); // 10 Amp Maximum bus with a shunt resistor of 0.1 Ohm
  Serial.print("Found ");
  Serial.print(deviceCount); 
  Serial.print(" INA2xx devices, displaying data for device 0, a \"");
  Serial.print(INA.getDeviceName());
  Serial.println("\".");
} // of setup
void loop() {
  uint16_t BusRaw = INA.getBusRaw(); // wait for conversion on device 0 to complete
  Serial.print("INA Bus voltage register value is ");
  Serial.print(BusRaw);
  Serial.print("\n");
  delay(5000); // wait 5 seconds before next measurement        
} // of main loop