Getting Current Voltage Input (VIN) on TS-7670 or TS-7400-V2

Here’s an example program our engineers might find useful. Kris Bahnsen, a long time engineer for Technologic Systems, wrote this simple program to get the voltage input (Vin) on the 8 – 28 VDC power rail on the TS-7670 (Rev. D or later) or TS-7400-V2 (Rev. B or later). Without going into too much detail about implementation of the on-board supervisory microcontroller, there is a register which is used to store various ADC values, including Vin. This example program basically polls this 4 byte register via I2C interface, accounts for the voltage divider (see TS-7670 schematic or TS-7400-V2 schematic), and spits out the Vin value. So, without further ado, here’s the code:


Compiling and Running

Once you’ve copied the source code over to the board, you can use the preloaded gcc command to compile like this:

Then, of course, run it! We have a 12 VDC power adapter plugged into the 8 – 28 VDC input, so we expect to see 12V reported as Vin (represented in mV):

Again, we hope you’ve found this example program to get Vin on the TS-7670 or TS-7400-V2 helpful. Let us know if you have any suggestions to make it better.

Author: Derek Hildreth

eBusiness Manager for Technologic Systems