Hi.
I have device and I conected to him using Ignition TCP Driver.
This device understend only HEX values.
In Ignition I write script that send HEX values to device.
def fromhex():
a = '1b02141b03e7'.decode('hex')
system.tag.write("_IJ600_/4001/Writable", a)
This HEX command 1b02141b03e7
means that the device must return devices status.
Device must reply this code 1B060000140302000000001B03DE
Also I write script to convert devices Tag Wrtitable and Massage to HEX:
def tohex():
readMes = (system.tag.read("_IJ600_/4001/Message")).value
readWrit = (system.tag.read("_IJ600_/4001/Writable")).value
encodeMes = readMes.encode('hex')
encodeWrit = readWrit.encode('hex')
system.tag.write("_IJ600_/Mess_hex",encodeMes)
system.tag.write("_IJ600_/Writ_hex",encodeWrit)
Problem - when I use my script to send data and conver what I send and what I received, I got this result:
At first sight problem is whit my device, but I cread simple TCP client using Python and using my script send him HEX data. And what I see: 1b02141b033f
Why Ignishion change last two HEX sybols from e7 to 3f I dont understand.
After that I picked the right code for Ignition, it is 1b02141b0337
.
When i send it to my simple TCP client I see thes: 1b02141b03e7
Then I send new Hex to my device using Ignition and what I recive: 140302fdfdfdfdfdfdfdfd1b032e
According to the instructions of the device I should get this HEX code 1B060000140302000000001B03DE
why Ignition changing some bits I dont understabd.
Please explain why Ignition does it, because when the I used simple TCP client, writing using python, to send commands and receive responses from the device, everything works correctly.
What is the solution of this problem?