Getting Current Voltage Input (VIN) on TS-7250-V2

Here’s an example program our engineers might find useful. Jesse Off, our lead engineer, wrote this simple program to get the voltage input (Vin) on the 8 – 28 VDC power rail on the TS-7250-V2 (Rev. B only). Without going into too much detail about implementation of the SiLabs microcontroller, there is a register which is used to store various ADC values, including Vin. This example program basically polls this 19 byte register via I2C interface, accounts for the voltage divider (see TS-7250-V2 schematic), and spits out the Vin value. So, without further ado, here’s the code:

get_vin.c

Compiling and Running

Once you’ve copied the source code over to the TS-7250-V2, 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.

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

Author: Derek Hildreth

eBusiness Manager for Technologic Systems