i´ve been successfully using a S7 1500 PLC in combination with an SQL-Server for quiete some time now. I set everything up like mentioned here: S7SQL-Guide-Stackoverflow Today i tried to add a second parameter to my SQL-Query. So I made something like this:
select Number1,Number2 from MYTABLE WHERE Apple = red and Sky = blue
The S7 sends the telegram, and the SQL-Server replies. So far so good.
I set up the size of TokenColumnMetaData accordingly to my wireshark record, compiled and send the updates to my PLC. Now the part which I don´t understand:
I am expecting to receive the value "12345" so again I used wireshark to see what I should expect:
So what I got is: 39 30 00 00, which is 12345 just the bytes are reversed -no problem so far, but when I check on S7-side, I see this:
My input is shifted by 1 Byte. How can I solve this? Unfortantely I don´t have deeper knowledge of the code provided by Siemens for this application.
Edit:
Screenshot of typeUseCaseSpecificTokenrow
Sometimes weird memory stuff happens when the data type comprises an odd number of bytes.
Siemens starts each element on an even memory address. So if Length
is at address 0 and Data
is at 2-5, then address 1 may be getting the first byte that is intended for Data
Address | Data | Element |
---|---|---|
00 | 04 | Length 0 |
01 | 39 | |
02 | 30 | Data 0, byte 0 |
03 | 00 | Data 0, byte 1 |
04 | 00 | Data 0, byte 2 |
05 | 08 | Data 0, byte 3 |
06 | 47 | Length 1 |
07 | 94 | |
08 | 03 | Data 1, byte 0 |
09 | 00 | Data 1, byte 1 |
10 | 00 | Data 1, byte 2 |
11 | 00 | Data 1, byte 3 |
12 | 00 | Length 2 |
13 | 00 | |
14 | FD | Data 2, byte 0 |
15 | 10 | Data 2, byte 1 |
16 | 00 | Data 2, byte 2 |
17 | C1 | Data 2, byte 3 |