Datasheet

Dec2Bcd
Bcd2Dec16
483
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function Dec2Bcd(dim decnum as byte) as byte
Returns Converted BCD value.
Description
Converts input number to its appropriate BCD representation.
Parameters :
-
decnum: number to be converted
Requires Nothing.
Example
dim a, b as byte
...
a = 22
b = Dec2Bcd(a) ' b equals 34
Prototype
sub function Bcd2Dec16(dim bcdnum as word) as word
Returns Converted decimal value.
Description
Converts 16-bit BCD numeral to its decimal equivalent.
Parameters :
-
bcdnum: 16-bit BCD numeral to be converted
Requires Nothing.
Example
dim a, b as word
...
a = 0x1234 ' a equals 4660
b = Bcd2Dec16(a) ' b equals 1234