Internet PLC Forum

General => Technical support => Topic started by: jbryant87 on October 26, 2018, 06:09:52 AM

Title: DM32 Problem
Post by: jbryant87 on October 26, 2018, 06:09:52 AM
I am sending a 32bit unsigned integer from a weintek HMI to a FX1616ba to location 4x1001 (dm[1])
The data is being sent as part of a recipe transfer. So 2 words will be sent.
I dont think the words are overflowing correctly as the numbers im seeing dont make sense

eg. sending 985 from HMI, dm32[1] reads 64552960 but dm16[1] reads correctly

sending 95674 from the HMI, dm[32] reads 1975123969
dm16[1] reads 30138 dm16[2] reads 1
Is there a conversion i can do to get these numbers to make sense?



Title: Re:DM32 Problem
Post by: garysdickinson on October 26, 2018, 11:19:30 AM
I can address your observation that the decimal value 95674 (HMI) ends up wrong in the PLC DM memory.

This is a word order issue.  The data transfer protocols that the HMI/PLC use break up 32-bit values into two 16-bit words.  The 16-bit values are sent and then must be reassembled on the receiving end. The problem is that the PLC and the HMI do not represent 32-bit values the same way.

The 32-bit decimal value of 95674 is 0x000175BA in hex.  The most significant 16-bits of the value is 0x0001 (1 decimal) and the least significant 16-bits is 0x75ba (30138).  If you use the i-TRiLOGI simulator you can write 95674 to DM32[1] and then View the DM memory as 16-bit data and you will see that DM[1] holds the value 1 and DM[2] holds the value 30138.  On the PLC the most significant part of a 32-bit number is stored first in PLC 16-bit memory (big endian).

In your example you started with the value of 95674 on the HMI and when it got sent to the PLC the 16-bit (word) order got messed up.  The HMI stores 32-bit values with the most least significant word first and the most significant word in the next memory location (little endian).

The HMI is sending the 32-bit data in the wrong order for the PLC.  If this is what you are seeing then you need to coerce the HMI into sending the 32-bit data in the correct order for the PLC to reassemble correctly.

You did not specify what protocol that you are using for the HMI to communicate with the PLC.  I would suggest that you use Modbus.  I can help you with the Modbus protocols.

Specify the data transfer protocol used by the HMI to communicate with the PLC.  I use Modbus RTU via the RS-232 port.  The critical part is "Conversion...".  Click on this button near the bottom right corner.  You want to set the 3x_Double and 4x_Double conversion to use the "ABCD -> CDAB" data conversion.  What this does is change the order that the 16-bit data words are sent/received to ensure that  the 32-bit value makes sense to both the HMI and PLC.

Now, set up address tag to access DM32[1] as a 32-bit signed integer:

If you are attempting to use the Host Command protocol, then you will need to call TRI for assistance.

Best regards,

Gary D*ckinson