User manual
586
mikoBasic PRO for PIC32
MikroElektronika
FloatToStr
Prototype
sub procedure FloatToStr(dim fnum as oat, dim byref str as string[20]) as
byte
Description Converts a oating point number to a string.
The output string is left justied and null terminated after the last digit.
Parameters - fnum: oating point number to be converted
- str: destination string
Returns Nothing.
Requires Nothing.
Example
dim ff1, ff2, ff3 as oat
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 oating point number will be truncated to 7 most signicant digits before conversion.
WordToStrWithZeros
Prototype
sub procedure WordToStrWithZeros(dim input as word, dim byref output as
string[5])
Description Converts input word to a string. The output string is right justied and the remaining positions on the
left (if any) are lled with zeros.
Parameters - input: unsigned integer to be converted
- output: destination string
Returns Nothing.
Requires Nothing.
Example
dim t as word
txt as string[5]
t = 437
WordToStrWithZeros(t, txt) ‘ txt is “00437”
Notes None.