Is it possible to use DI[n] to input a value into R[n].
For instance R[30]=DI[47] where every time DI[47] is triggered to an on state it adds 1 to the value of the contents in R[30]?
Use DI to input into Registers
-
wheensy -
April 9, 2015 at 10:50 PM -
Thread is marked as Resolved.
-
-
Make two programs One called "r_state" and the other the one you are running
r_state, just one line
r30=r30 +1your program
move l
move l
id di47=on call r_state
move l
move l -
To expand on Fabian's post, you could tie r_state to a macro triggered by DI[47].
That way every time DI[47] went high, it would increment R[30].
-
You can also use something like this code in bakground logic if you want this trigger to count independently of the robot program.
1: IF (F[100:Helpflag1]=OFF AND DI[47]=ON),R[30]=(R[30]+1) ;
2: F[100:Helpflag1]=(DI[47]) ;