Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
FloatToStr
Dec2Bcd
490
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
procedure FloatToStr(input : real; var output : array[23] of char);
Returns
3
if input number is NaN 
2
if input number is -INF 
1
if input number is +INF 
0
if conversion was successful 
Description
Converts a floating point number to a string.
Parameters : 
input
: floating point number to be converted 
output
: destination string 
The output string is left justified and null terminated after the last digit.
Note: Given floating point number will be truncated to 7 most significant digits
before conversion.
Requires
Nothing.
Example
var ff1, ff2, ff3 : real;
txt : 
array[23] of char;
...  
ff1 := -374.2;
ff2 := 123.456789;
ff3 := 0.000001234;
FloatToStr(ff1, txt);  // txt is "-374.2"
FloatToStr(ff2, txt);  // txt is "123.4567"
FloatToStr(ff3, txt);  // txt is "1.234e-6"
Prototype
function Dec2Bcd(decnum : byte) : byte;
Returns
Converted BCD value.
Description
Converts input number to its appropriate BCD representation. 
Parameters : 
decnum
: number to be converted 
Requires
Nothing.
Example
var a, b : byte;
...
a := 22;
b := Dec2Bcd(a); // b equals 34