Sending Hex Data To A Com Port


dle

Recommended Posts

How can I send \xAA\x0D\x00\x00\x00\x00 to a COM port using device write function?

 

I could send that Hex data to a COM port from the COMM monitor but don't know how to send those Hex data from Device.COMPort.write(xxxx) 

Link to comment
Share on other sites

device.myDevice.write(chra({0xaa, 0x0d, 0x00, 0x00, 0x00, 0x00})

 

1) remember, you access the comm port through the device its associated with, not by the comm port name

2) {} creates an array (can only contain constants)

3) 0x prefix means that the value after is hex

4) chra() takes an array, and converts it into a string of characters

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.