Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transmit in Hex

Status
Not open for further replies.

Maieski

Programmer
Sep 6, 2002
3
BR
How may i transmit data and receive in hex?

transmit "41H ABH E1H ODH OAH"
waitfor "41H ABH 0DH 0AH" 5

thanks
 
If you are wanting to use those exact literal strings, then the waitfor command should work without any problems.

To get the transmit command to output the data the way you wish, the following script is one way to do it:

proc main
string sInput = "TEST", sOutput, sTemp
integer iLen, iCount, iTemp

strlen sInput iLen
for iCount = 0 upto iLen-1
strgetc sInput iCount iTemp
strfmt sTemp "%dH " iTemp
strcat sOutput sTemp
endfor
strlen sOutput iLen
strdelete sOutput iLen-1 1
endproc

sInput is the string you want to convert and sOutput is the string in hex format. In the example above, the input text is TEST and the output is 84H 69H 83H 84H.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top