mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

Dec2Bcd

Prototype

unsigned short Dec2Bcd(unsigned short decnum);

 

 

Returns

Returns converted BCD value.

 

 

Description

Converts 8-bit decimal value decnum to BCD.

 

 

Example

unsigned short a;

 

...

 

a = Dec2Bcd(52); // equals 0x52

 

 

Bcd2Dec16

Prototype

unsigned Bcd2Dec16(unsigned bcdnum);

 

 

Returns

Returns converted decimal value.

 

 

Description

Converts 16-bit BCD numeral bcdnum to its decimal equivalent.

 

 

 

Example

unsigned a;

 

 

...

 

 

a = Bcd2Dec16(1234);

// equals 4660

 

 

 

Dec2Bcd16

Prototype

unsigned Dec2Bcd(unsigned decnum);

 

 

 

Returns

Returns converted BCD value.

 

 

 

Description

Converts 16-bit decimal value decnum to BCD.

 

 

 

Example

unsigned a;

 

 

...

 

 

a = Dec2Bcd16(4660);

// equals 1234

 

 

 

page

 

302

MikroElektronika: Development tools - Books - Compilers