Mikroelektronika MIKROE-724 データシート

ページ / 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
667
ByteToHex
Prototype
dim procedure ByteToHex(dim input as byte, dim byref output as string[2])
Description Converts input number to a string containing the number’s hexadecimal representation. The output 
string is right justified and remaining positions on the left (if any) are filled with zeros.
Parameters 
input
: byte to be converted  
output
: destination string 
Returns
Nothing.
Requires
Nothing.
Example
dim t as byte
    txt as string[2] 
t = 2
ByteToHex(t, txt)  ‘ txt is “02”
Notes
None.
ShortToHex
Prototype
sub  procedure  ShortToHex(dim  input  as  short,  dim  byref  output  as 
string[2])
Description Converts input number to a string containing the number’s hexadecimal representation. The output 
string is right justified and remaining positions on the left (if any) are filled with zeros.
Parameters 
input
: short number to be converted 
output
: destination string 
Returns
Nothing.
Requires
Nothing.
Example
dim t as short
    txt as string[2]
  ...  
t = -100
ShortToHex(t, txt)  ‘ txt is “9C”
Notes
None.