Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Henryp on May 30, 2018, 11:04:14 AM
-
I'm trying to count the number of times a stage has ran by using the $main.S3 signal to increment a counter. However it doesn't work. I tried using a control relay driven by the $main.S3 signal it doesn't work either. However, if I force then un-force the control relay it works just fine. Attached is a print screen showing the logic.
-
The counter won't increment because it never sees the input to the counter off. When the stage is inactive, the counter is not scanned.
-
Would a one shot work for the input to the counter? But can not jump out of the stage before that happens. If the bit on the rung of your jmp happens before the one shot is able to work then that won't work either. Maybe just put the counter in a stage or section of the program that is always running.
-
I can try it in the always on stage but according to the documentation "Each time this input logic transitions from OFF to ON, the Counter's accumulator will increment by one"
-
Reserve a C bit. Place an 'always on' rung at the end of the stage leading to an OUT of the C bit. Somewhere earlier in the stage place a rung with a normally closed of the C bit leading to an increment of a register. The register will increment once per execution of the stage. (This is assuming there is at least one scan between the stage ending and it being called again. If this may not be true place an RESET of the chosen C bit in the same rung or stage which triggers the monitored stage.)
-
Check your to make sure the stage is activated either with a JMP or SGSET command.
-
I would not even use a counter, and instead use an INC, or even MATH.
-
I would not even use a counter, and instead use an INC, or even MATH.
My thought as well.