I AM GETTING SOME DATA FROM TEMPERATURE SENSOR. IT IS A DOUBLE DATA TYPE. IS IT POSSIBLE TO CHANGE IT TO LONG OR INT DATA. AND JUST KEEP THE INTEGER PARTS. THX
1. Disable your CAPS LOCK! 2. Yes. If you really get the value as a Keil-supported floating point value then you should need only cast the float type to an int type. E.g.
float tempSensorValue = readTempSensor() /* ??? */; int integer = (int) tempSensorValue; unsigned int fraction = (unsigned int) (1000 * (tempSensorValue - integer)); printf("Result is %d.%u\n", integer, fraction);
Hi ry uran, may i know whether you are using C51/8051 for your programming? Because I am doing a temperature sensor but using 8051 micro-controller. From jepthah