INT_TO_BCDΒΆ

This function, proided by The library UTIL.Library\ \,  converts an INTEGER value into a byte in BCD format:

The input value of the function is type INT, the output is type BYTE.

The number 255 will be outputted where an INTEGER value should be converted which cannot be converted into a BCD byte.

Examples in ST:\ \ \ \

i:=INT_TO_BCD(49);  (\* Result is  73 \*)

k:=BCD_TO_INT(97);  (\* Result is  151 \*)

l:=BCD_TO_INT(100); (\* Error! Output: 255 \*)