Questions and discussions about the software that runs on the TD RF module itself.
Posts: 22
Joined: Tue Jun 09, 2015 2:31 pm

How to convert the mV to V (Integer value to float)

by Capture Fri Jun 26, 2015 9:11 am

Hello Everyone

I wrote the program for measuring the supply Voltage then after compiling, it is displaying the output by default in mV(3253mV) but i want to see the output interms of voltage so i did this in the libary function td.measure.c (setpoint = ((setpoint * 3 * 1250) / 4096);) after that it is displaying the round off value (3v) and also i tried to change the datatype of setpoint to float eventhough am not able to see the output like (3.2v) so can anyone suggest me the best possible solution to see the output interms of voltage.

tfp_printf("Battery Meas:%d mV\r\n",

Best regards
User avatar
Posts: 145
Joined: Mon May 11, 2015 7:47 am

Re: How to convert the mV to V (Integer value to float)

by lcheminade Fri Jun 26, 2015 10:25 am


This is just common C.

uint32_t mv = TD_MEASURE_VoltageTemperatureExtended(false);

uint8_t volt = mv /1000;

uint32_t decimal = mv - (volt*1000);

tfp_printf("Voltage %d.%03d\r\n, vold,decimal);

Return to Firmware

Who is online

Users browsing this forum: No registered users and 1 guest