
CHAPTER 3
Advanced Functions
102
The last step is to convert the analog values to actual engineering
units. This is easily accomplished if we know what sensor is
connected to each input of the RTU, and its conversion equation.
Let’s assume that a temperature sensor is connected to the
Analog7 input. Then:
Note that 2669 is A6D converted to decimal while the -40 was
necessary because the standard Adcon temperature sensor has a
range from -40 to 60 ºC.
Similarly, the battery level can be computed as follows:
Note here that we had to deal with an 8-bit value (59 hex = 89
decimal), so the divider is 255, while the previous example was
based on a 12-bit conversion and the divider was 4095.
Temp
°C[]
2669 100⋅
4095
------------------------- 40– 25,17==
Batt
V[]
89 20⋅
255
---------------- 6,98==
Comentarios a estos manuales