ZestyMozzarella
Lifetime Supporting Member
Hi everyone, trying to get data out of a digital encoder that is little endian into my Siemens S7-1200 controller that is big endian...it's an issue lol.
My modbus communications read successful open no issue (code 7004) but the data reads all zeroes (as expected). On other master platforms outside Siemens, all zeroes is the same result if the byte order is not correct. Someone suggested using the SWAP function to me but if I read the data into the MB_Client and it comes in zeroes, then I swap it, it reads zeroes lol.
It's almost like I need the data swapped pre-transit before going into the MB_client function to be interpreted and stored in a DWORD properly. Anyway, I'm wondering if someone has had little endian to Siemens big endian issues before and might be able to look at this code and offer advice (or just in general for the need). The encoder modbus data is on page 76 of the PDF and while I realize the input data would technically be 30002 for velocity data, Siemens starts at 30001, so I did account for the offset and am looking at 30003 in code with a length of 2 for DWORD.
It was programmed in TIA Portal V16 FYI. Could create lower if need be. Thanks in advance for any advice anyone can offer!
My modbus communications read successful open no issue (code 7004) but the data reads all zeroes (as expected). On other master platforms outside Siemens, all zeroes is the same result if the byte order is not correct. Someone suggested using the SWAP function to me but if I read the data into the MB_Client and it comes in zeroes, then I swap it, it reads zeroes lol.
It's almost like I need the data swapped pre-transit before going into the MB_client function to be interpreted and stored in a DWORD properly. Anyway, I'm wondering if someone has had little endian to Siemens big endian issues before and might be able to look at this code and offer advice (or just in general for the need). The encoder modbus data is on page 76 of the PDF and while I realize the input data would technically be 30002 for velocity data, Siemens starts at 30001, so I did account for the offset and am looking at 30003 in code with a length of 2 for DWORD.
It was programmed in TIA Portal V16 FYI. Could create lower if need be. Thanks in advance for any advice anyone can offer!
Last edited: