Hitachi EH-150 Weather Radio User Manual


 
7. Collection of Temperate Data
7-4
7.3 Example of Calculation
The program shown below as an example converts the temperature conversion data in WR0 to
BCD 4 digit data in WM6.
In case the temperature is minus, the bit internal output R0 will be turned on.
(1) Because the calculation with sign is that by double words, extend the word temperature
conversion data(WR0) to double word data(stored in DM0).
(2) (3) Calculate by the expression mentioned on previous page. Because the calculation with
decimal point (dividing by 40.96) is not possible, multiply the numerator with 100 (2) and then
divide by 4,096(3).
(4) When the temperature data (result of calculation) is minus, the R0 is turned on.
(5) Turn to an absolute variable (for plus temperature data, use as it is and for minus temperature
data remove the sign to turn it to a plus value.) (Use WM0 because the result of calculation can
be incorporated in a word (less than 16 bits).
(6) WM 4 is converted to BCD 4 digits vaule(WM6).
EXT (DM000,WR0000) (1)
DM000 = DM000 S* 100 (2)
DM002 = DM000 S/ 4096 (3)
R0 = DM002 S< 0 (4)
ABS (WM004,WM002) (5)
BCD (WM006,WM004) (6)