Host Engineering Forum
General Category => General Discussion => Topic started by: ivelectric on June 12, 2017, 10:14:55 PM
-
Hi,
I have a BX-DM1E-36ED13-D hook up to a Quad encoder. i'm using a greater than instruction and the quadrature counter function to set some outputs, the problem am having is that the
encoder value its lost at power up after a power outage. can somebody help me with this?
Thank u.
-
You'll basically need to store the encoder count in a memory location. Then, on first scan, you can write the stored number back into the $encoder.acc location.
-
You'll basically need to store the encoder count in a memory location. Then, on first scan, you can write the stored number back into the $encoder.acc location.
That's half right. The accumulator location is an output from the counter hardware, writing directly to it won't help. The workaround requires three registers...we'll call them Accumulator, LastAcc, AccOffset...and LastAcc and AccOffset must be retentive.
1. In $tFirstScan, MATH AccOffset = AccOffset + LastAcc
2. In $TopOfScan, MOVE $Ctr.Acc to LastAcc and MATH Accumulator = $Ctr.Acc + AccOffset
3. In your code, reference Accumulator instead of $Ctr.Acc
4. When you reset the counter, be sure to reset AccOffset
We will definitely fix this. The fix will be in the next release.
-
Ok, thank you guys for your reply.
i will give it a try.
-
Ok, thank you guys for your reply.
i will give it a try.
We've already fixed this, but it won't be released until August. In the meantime, the workaround I described should be fine.