Monitoring the "Change" in a tag value.

xC0MMAND0x

Member
Join Date
Jul 2013
Location
Minnesota
Posts
265
Greetings!

I am wondering what Instruction to use for the following scenario...

I have some PLC Tags that represent the "Status" of a particular machine. The Status values are integers ranging from 1-5 in value; I have all of the setup and working no problems.

Now, I need to setup a Monitoring BOOL as a trigger for some data processing. Essentially I need to have a BOOL that triggers TRUE if the Value of "Status" changes at all.

Is there an instruction geared for monitoring a value or seeing if it changes values?

I suppose I could use a compare register and use the current value of the Status tag to compare, but I figured there should be an easier way.

Thanks!
 
What processor? Look at DTR. Or you can program your own. DTR only works on DINTs.

Seems like this *should* do what I want, if I convert my data for the machine status into an Array.

I tried this as a test, and I couldn't get the output to latch on.



I have a test array, referencing itself, and I changed the value. I looked at the instruction help.

I just want to compare a tag value to itself, and if it's changed in a scan I need an output to turn true.
 
use a timer, when timer ticks move your tag value to a know place, next time timer ticks compare instant tag value to value you move a moment ago if they are the same do nothing is values are different set a bit.
 
I do it the simple way: compare the current status value to the "old" status value, then copy the current status value to the "old" status value tag. You can do it with latches, or as though it was a one-shot.

Status_Change.png
 
Ken, in your example the counter would not count up correctly if the status changed on adjacent scans. If that were critical an ADD might be better.
 
Ken, in your example the counter would not count up correctly if the status changed on adjacent scans. If that were critical an ADD might be better.

Excellent point, Bernie.

I am not using a counter as an output, just a Toggle that loads data into a FIFO register. I tested things out with the logic and it's working perfectly!

As always, thank you to this wonderful community and all of those who helped.
 
I usually do this the simple way, which generates an output bit that is true for one scan whenever the value changes. The attached pic shows the code I use.

However, if the value can change again during the same scan, the bit will remain true, so it doesn't indicate every "change-of-state". I would hazard a guess that your machine "state" can't change more than once during a single processor scan

But this begs the question "Is there code in the PLC that writes new values to the machine status?". If there is, why can't that same code trigger a conditional JSR, or even an EVENT instruction to go and do your data processing.

2013-12-03_000441.jpg
 
You also said you wanted to generate a BOOL whenever the value changed, to initiate data-logging.

Do you need the BOOL tag, you can execute the data-logging directly without having to create a new tag....

2013-12-03_000846.jpg
 
Seems like this *should* do what I want, if I convert my data for the machine status into an Array.

I tried this as a test, and I couldn't get the output to latch on.



I have a test array, referencing itself, and I changed the value. I looked at the instruction help.

I just want to compare a tag value to itself, and if it's changed in a scan I need an output to turn true.

Your test doesn't work because you have the source and reference set to the same tag. The DTR looks for differences between source and reference, filtered by the mask. The tag you're testing will always be equal to itself.

So, create a separate tag for the reference. The DTR will copy the source to the reference each scan, after comparing. With the mask set to '1', you will only be checking for changes to bit 0 of the source. Set the mask to '-1' to check all bits.
 

Similar Topics

Hello, anyone know how to make a logic that monitors the change in position of a carriage through some rails ?. In my application I measure the...
Replies
9
Views
2,096
Hello everyone! I need to connect to a DL205-1 CPU and, as far as I know, I need to use DirectSOFT 6 software for the connection. Is anyone...
Replies
1
Views
62
Our punch press has a SLC500 with HELM weight module (HM-604-WM) for tonnage monitoring. The operator enters the weight range on the HMI, which is...
Replies
9
Views
201
Hello, I have been trying to figure out how to connect to and monitor a DLR that is on a remote rack from my PLC. The local has a 1756-L81E and...
Replies
0
Views
117
Good day, we have 15 analog inputs, we need to log the data in excel and monitor these values through web browser. We're planning to go with Delta...
Replies
1
Views
118
Back
Top Bottom