Showing results for 
Search instead for 
Did you mean: 

How can i store a value in a register, to be called up later in the program. I must be able to read and write to it.

Im looking at a bearing reading and i only want it to do a case loop if the data has changed on the bearing, so i need a value of what it was a cycle ago to compare it with, how do i do this?
0 Kudos
Message 1 of 3
I'm not sure I,ve understood you clearly but it looks like you need to use "shift registers" in the loop.
Shift registers allow you to pass data from one iteration of the loop to another. For example in the situation when you need to know the value of some variable on previous iteration or on pre-previous etc.

To create shift registers on the loop you have to right click on the border of the loop and select "Add shift register" from pop up menu. Two arrows will appear on the left and right sides of the loop. To write data to the shift register you have to wire them to the right arrow, and to read data you have to read it from the left arrow. When you read data from shift register you read the value from the previous iteration. When you write data - you wri
te the curent value there. If you want to read preprevious data you have to click on the left side of shift register and select "Add Element". The new element (arrow) will appear which corresponds to preprevious value. And so on. To initialize shift registers before execution of the loop you have to wire the some data from the outside.

Another solution of your problem is using of local variables. You can create them from pop up menu of each control or indicator on the diagram. You can set them as read or write local.

Good luck.
Read help.

Oleg Chutko.
0 Kudos
Message 2 of 3
Did you try using shift-register, local variable or global variable?

0 Kudos
Message 3 of 3