A program to detect register change?

mosama

Member
Join Date
May 2009
Location
Egypt
Posts
182
Hi every one

I' using Unity Pro software. Is there a function for detecting instantaneous change in a register value and display whether it is increased or decreased or did not change?
And if there is not a function like this, can any one help me in programming it?

Regards
 
Create following varibales in the Data Editor

iVar of type INT
bIncr of type BOOL
bDecr of type BOOL
bNoChange of type BOOL
iTempVar of type INT

ST Section

if iVar > iTempVar then
bIncr := true;
else
bIncr := false;
end_if;

if iVar < iTempVar then
bDecr := true;
else
bDecr := false;
end_if;

if iTempVar = iVar then
bNoChange :=true;
else
bNoChange :=false;
end_if;

iTempVar := iVar;



NOTE: The register change comparison is made every scan and if there is a change in the iVar , the respective BOOL varibale will be TRUE only for one scan and the next scan it return to NO Change state.
 

Similar Topics

Replies
15
Views
3,523
Hi guys, I've an application where the temperature will be feeding back to the PLC. Upon PLC detected 3 times of the temperature of the product...
Replies
4
Views
2,828
Hi Experts, Is there a way to detect if a Omron CPU is set in program mode (for an example special register/bit)? Any suggestions are greatly...
Replies
5
Views
2,852
I have an old Sentry Palletizer (S/O Number 3007 / Serial Number 1172) that has lost its program as the backup battery died years ago. I can...
Replies
0
Views
89
Hi All, As a precaution my company has been collecting copies all the HMI and PLC programs. I have recorded copies of most of our sites...
Replies
0
Views
63
Back
Top Bottom