Datasheet
Dec2Bcd
Bcd2Dec16
566
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
unsigned short Dec2Bcd(unsigned short decnum);
Returns Converted BCD value.
Description
Converts input unsigned short integer number to its appropriate BCD represen-
tation.
Parameters :
- decnum: unsigned short integer number to be converted
Requires Nothing.
Example
unsigned short a, b;
...
a = 22;
b = Dec2Bcd(a); // b equals 34
Prototype
unsigned Bcd2Dec16(unsigned bcdnum);
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
unsigned a, b;
...
a = 0x1234; // a equals 4660
b = Bcd2Dec16(a); // b equals 1234