I need to send Hex data like a command to my serial port using Delphi.
The Hex data like "0x1b 0x31".
What the procedure can I used ?
writestring()
or writebuffer()
? How to use them ?
If you use TComPort
from ComPort Library (sourceforge), then invoke WriteStr()
method:
ComPort.WriteStr(chr($1b));
If you use TApdComPort
from TurboPower component, use the PutChar()
method (according that command you want to send is $1b):
ApdComPort1.PutChar(char($1b);