Conversions library, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 307

Advertising
background image

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

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

MikroElektronika: Development tools - Books - Compilers

299

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Conversions Library

Library Routines

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)

ByteToStr

Advertising
This manual is related to the following products: