Mikroelektronika MIKROE-350 Hoja De Datos
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
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
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
...
a = 0x1234 ' a equals 4660
b = Bcd2Dec16(a) ' b equals 1234