Mikroc, Bcd2dec, Longtostr – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 309: Floattostr

Advertising
background image

MikroElektronika: Development tools - Books - Compilers

301

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Prototype

unsigned short

Bcd2Dec(unsigned short bcdnum);

Returns

Returns converted decimal value.

Description

Converts 8-bit BCD numeral

bcdnum

to its decimal equivalent.

Example

unsigned short

a;

...

a = Bcd2Dec(0x52);

// equals 52

Bcd2Dec

Prototype

void

LongToStr(long number, char *output);

Description

Function creates an

output

string out of a large signed

number

(numerical value of

long

type). Output string has fixed width of 11 characters; remaining positions on the

left (if any) are filled with blanks.

Example

long

jj = -3700000;

char

*txt;

//...

LongToStr(jj, txt);

// txt is " -3700000" (three blanks here)

LongToStr

Prototype

void

FloatToStr(float number, char *output);

Description

Function creates an

output

string out of a floating-point

number

. The output string

contains a normalized format of the number (mantissa between 0 and 1) with sign at the
first position. Mantissa has fixed format of six digits,

0.ddddd

; i.e. there will always be

5 digits following the dot. The

output

string must be at least 13 characters long.

Example

float

ff = -374.2;

char

*txt;

//...

FloatToStr(ff, txt);

// txt is "-0.37420e3"

FloatToStr

Advertising
This manual is related to the following products: