This example reads information such as the remaining capacity from a smart battery fuel gauge via the TWI bus. The bus is implemented with two DIOs, see also I2C.
Project: ZSOM-Control_SmartBattery.lvproj, VI SmartBattery_RT_main.vi. In LabVIEW, open Help → Find Examples and search for “ZSOM”.
| Indicator | Function |
|---|---|
| remaining [%] | Remaining capacity in percent |
| remaining hours | Remaining operating time in hours |
| Voltage [V] | Battery voltage |
| Current [A] | Battery current |
| Power [W] | Battery power |
SmartBattery_FPGA_main.vi): Implements the TWI bus on the lines DIO 1 (clock) and DIO 2 (data). The RT exchanges the data with the bus through FIFOs.SmartBattery_RT_main.vi): Loads and starts the FPGA and then reads the battery values in a loop (wait time 500 ms) with Fuelgauge.vi. The SubVI TWIdevice.SmartBattery.vi accesses the registers of the smart battery.