News:

  • June 11, 2026, 03:14:34 AM

Login with username, password and session length

Author Topic: BRX, Encoder  (Read 9791 times)

ivelectric

  • Newbie
  • *
  • Posts: 2
BRX, Encoder
« 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.

Evilbeard

  • Hero Member
  • *****
  • Posts: 160
Re: BRX, Encoder
« Reply #1 on: June 14, 2017, 10:06:45 AM »
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.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: BRX, Encoder
« Reply #2 on: June 14, 2017, 10:40:29 AM »
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.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

ivelectric

  • Newbie
  • *
  • Posts: 2
Re: BRX, Encoder
« Reply #3 on: June 16, 2017, 07:24:42 PM »
Ok, thank you guys for your reply.
i will give it a try.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6158
  • Yes Pinky, Do-more will control the world!
Re: BRX, Encoder
« Reply #4 on: June 17, 2017, 01:17:14 AM »
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.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO