Mikroelektronika MIKROE-724 データシート

ページ / 726
664
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
LongWordToStr
Prototype
sub  procedure  LongWordToStr(dim  input  as  longword,  dim  byref  output  as 
string[10])
Description Converts input double word number to a string. The output string is right justified and the remaining 
positions on the left (if any) are filled with blanks.
Parameters 
input:
 double word number to be converted 
output:
 destination string 
Returns
Nothing.
Requires
Nothing.
Example
dim input as longint 
    txt as string[10]
...
input = 12345678
IntToStr(input, txt)    ‘ txt is “  12345678”
Notes
None.
FloatToStr
Prototype
sub procedure FloatToStr(dim fnum as float, dim byref str as string[20]) as 
byte
Description Converts a floating point number to a string.
The output string is left justified and null terminated after the last digit.
Parameters 
fnum
: floating point number to be converted 
str
: destination string 
Returns
Nothing.
Requires
Nothing.
Example
dim ff1, ff2, ff3 as float
    txt as string[20]
  ...  
  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”
Notes
Given floating point number will be truncated to 7 most significant digits before conversion.