I'm trying to control some HART devices by using LiveCode. Since there is no support for that I have to manually create and send data via serial COM ports. I have been able to open and close the port, and I know what bytes to write but I don't know how.
This is how I open it and close it.
Code: Select all
local tPortName
put "COM4:" into tPortName
close file tPortName
open file tPortName for binary update //text, binary, write, update, read
// write command?
answer the result
close file tPortName
HART Command #1
Read:
FF FF FF FF 86 91 17 8A F9 A7 01 07 00 54 11 BF 51 84 67 9A
Write:
FF FF FF FF FF 82 91 17 8A F9 A7 01 00 D1
The write command contains both header and body bytes. I'm just clueless how to write hex bytes via LiveCode. My idea is that if I'm able to write those same bytes, I should get the same response, emulating the protocol and start working from there. Any ideas how to write Hex bytes to COM port ?
Thank you!