TheWaterboy
Lifetime Supporting Member + Moderator
I am trying to Insert a value into the Total register of an already running totalizer. I can do it one step at a time in the tag database but I am trying to automate it for a single button press from the operator.
Here's the Totalizer
Here is the trigger bit from the operator that would call the ST
Nothing too weird so far.
Here is the ST called "ResetCurrentTotalizer" I am trying to make work
After failing to make it work in FB I tried ST. I have played with several iterations of this, the above being my last for today, and while this is not the example, I can get the total to reset to a specified value but can't re-populate the .OldTotal back to what it was.
This last piece of code using REPEAT... UNTIL faulted the processor so its obviously looping and not the answer.
I can't walk through the ST and the watch window doesn't work on this version of firmware (17.2) anyway (Grrr)
Here's the Totalizer
Here is the trigger bit from the operator that would call the ST
Nothing too weird so far.
Here is the ST called "ResetCurrentTotalizer" I am trying to make work
Code:
// Intent...
// Copy .OldTotal to storage location
// Insert Specified Value into .Total
// .ProgResetReq will move .Total into .OldTotal so need to put .OldTotal back
// then Reset all the control bits
//Capture OldTotal
ST_Var1:=JunkOldTotal;
(*
REPEAT
//Write to Totalizer Reset Value Register
JunkTotalizer.ResetValue:=JunkResetValue;
//Assert Reset bit - Writes JunkResetValue Value to .Total
JunkTotalizer.ProgResetReq:=1;
UNTIL JunkTotalizer.ProgResetDone
END_REPEAT;
*)
//Write Old Total back to totalizer
JunkTotalizer.OldTotal:=ST_Var1;
//Clear the Reset Requests
JunkProgResetReqST:=0;
JunkTotalizer.ProgResetReq:=0;
//Increment a test counter
JunkST_Runs:=JunkST_Runs + 1;
After failing to make it work in FB I tried ST. I have played with several iterations of this, the above being my last for today, and while this is not the example, I can get the total to reset to a specified value but can't re-populate the .OldTotal back to what it was.
This last piece of code using REPEAT... UNTIL faulted the processor so its obviously looping and not the answer.
I can't walk through the ST and the watch window doesn't work on this version of firmware (17.2) anyway (Grrr)