mikroC

making it simple...

Conversions Library

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC Conversions Library provides routines for converting numerals to strings, and routines for BCD/decimal conversions.

Library Routines

 

You can get text representation of numerical value by passing it to one of the fol-

 

lowing routines:

 

ByteToStr

 

ShortToStr

 

WordToStr

 

IntToStr

 

LongToStr

 

FloatToStr

 

Following functions convert decimal values to BCD (Binary Coded Decimal) and

 

vice versa:

 

Bcd2Dec

 

Dec2Bcd

 

Bcd2Dec16

 

Dec2Bcd16

ByteToStr

 

 

 

Prototype

void ByteToStr(unsigned short number, char *output);

 

 

Description

Function creates an output string out of a small unsigned number (numerical value

 

less than 0x100). Output string has fixed width of 3 characters; remaining positions on

 

the left (if any) are filled with blanks.

 

 

Example

unsigned short t = 24;

 

char *txt;

 

//...

 

ByteToStr(t, txt); // txt is " 24" (one blank here)

 

 

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

299