Simply saying I have rough time trying to prepare proper FINS Command to PLC.
Topology:
- PC (with Java app) IP: 10.1.0.57
- OMRON CS1 PLC IP: 10.1.0.50
Now trying to prepare message for D0100 address. Message looks like this:
80 00 02 00 32 00 00 39 00 01 01 01 82 00 64 00 00 01
So:
ICF: 0x80
RSV: 0x00
GCT: 0x20
DNA: 0x00
DA1: 0x32 (50(dec) which is last octet of PLC IP)
DA2: 0x00
SNA: 0x00
SA1: 0x39 (57(dec) which is last octet of PC IP)
SA2: 0x00
SID: 0x01 (I am increasing this val in every new read)
COMMAND CODE: 0x01 0x01 (read Memory value)
MEM: 0x82
ADDR: 0x00 0x64 (100dec)
BIT: 0x00 (whole address)
LEN: 0x00 0x01 (1 address)
According to the doc everything seems to be ok, but the answer which I am receving has 16 bytes and it looks like this:
70 73 78 83 00 00 00 08 00 00 00 03 00 00 00 03
Socket is crashing after 2nd read try.
EDIT: I managed to add FINS Header at the beginning of message:
46 49 4e 53 00 00 00 1a 00 00 00 02 00 00 00 00
Which should be:
0x46: F
0x49: I
0x4e: N
0x53: S
0x00 0x00 0x00 0x1a: 26 - message length
0x00 0x00 0x00 0x02 &
0x00 0x00 0x00 0x00 - part of the response which I got on the beginning. Not sure at all if correct...
Now Socket is not crushing but, if I am trying to read anything there is no data. What I am missing? Where I should look to troublshoot the problem? I don't have direct access to PLC, but I can see data flow in OPC Server on the same PC.
Thanks in advance. Adam