Why does my direct window position value reset to 0 occasionally?

Why does my direct window position value reset to 0 occasionally? https://forum.weintekusa.com/uploads/db0776/original/2X/6/62a63d3bd34e6d26859395ef7441b2869818c242.png
none 0.0 0
  • HMI Model: cMT-3108XP using Codesys as the PLC
  • EasyBuilder Pro Version: V6.09.02.338

I’ve added a Direct Window to a screen using Dynamic Position. It needs to stay at a constant spot on the y-axis but move left to right on the x-axis.

To add more detail - this is representing the position of an object moving to/from an IO-Link laser distance sensor.

Everything is working well except one thing - while the x-axis travel works perfectly, the y-axis position occasionally flickers to 0. Below is the setting for the dynamic window.

Below is the Data Transfer setting to write a constant value from Codesys into that LW-19 register. I’ve got it set to update at the fastest setting of 0.2 seconds but occasionally it flickers up to the top of the screen.

The x-axis is handled the same way, but I haven’t seen it flicker. It moves left to right perfectly as I move the objects to and from the sensor.

How can I write a value to an LW register as a constant and it stays at that value? This value never needs to change. I tried using a Set Word button but it just writes a 0 back into LW-19 once I release the button.

Hi @JDControlsLLC,

The objy tag is a LINT which is 64-bits in length, while LW-19 is a word register which is 16-bits in length. It may not be the cause of this issue, but I would recommend using the same data type during transfer. For reference, a 64-bit type when written into LW-18 will overwrite LW-19, LW-20, and LW-21. Similarly a 64-bit type written into LW-19 will overwrite LW-20, LW-21, and LW-22. Due to the type difference, there may be some conflicting writes depending on your setup.

To correct this, I would recommend switching the CODESYS variable types to a 16-bit type. Here are some examples: Link
Note: Each LW register, as in LW-0 or LW-1 is 16-bits in length.

Assuming the issue above is not related to this, please use the method shown within this tutorial to determine if there is any overlap with other objects or command registers used in your project: Link

That was it, thanks! Just needed to make those all INTs.

So when I first started messing with the Data Transfer, I did see LINT as the datatype by default for some reason and thought that’s what EBP wanted. So that prompted me to change all the variable datatypes in Codesys to LINT.

Works great now!

1 Like

@JDControlsLLC,

Excellent, thank you for the update! I’m happy to hear everything is back on track, please let us know if you have any other questions.