Author Topic: HSC + Encoders  (Read 1427 times)

Wojciech

  • Guest
HSC + Encoders
« on: January 20, 2004, 03:31:15 AM »
I tried to use HSCs to detect changes in rotation of quadrature encoders and based on that update internal counters. Encoders were connected to inputs #3 - #6. What I noticed was that counter values were changed on every 4th 'click' of each of the encoder as if the HSCs reacted only to a complete encoder cycle before updating counter values. I am looking for some suggestions on how to use HSC features to change counters on every quadrature encoder event.

PS. I wrote my own function that does just that, but I am also interested in using built in functions.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3118
    • View Profile
    • Internet Programmable PLCs
Re: HSC + Encoders
« Reply #1 on: January 20, 2004, 02:26:19 PM »
The HSCs count every incoming quadrature pulses. It is not true that it counts one in four transitions. It determines the direction of counts based on the phase differences between the two inputs. If you have enabled the enhanced quadrature counting then the B phase must transit in proper relation to phase A in order for the count to be recognized.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Richard Baum

  • Guest
Re:HSC + Encoders
« Reply #2 on: June 13, 2004, 07:10:51 AM »
I too am having similar problems with the Quadrature Encoder.

It seems to only increment the counter on the rising edge of Phase A, or every four clicks.  This divides the effective resolution of my encoder by 4.  For true Quadrature Encoder decoding, the counter should change on both the rising and falling edges of both Phase A and Phase B.

I would be interested in getting that aftermarket code for real Quadrature Encoder decoding from you.  I assume you used interrupts for this?

It would be a good enhancement for the next firmware release of the PLC to fix the Quadrature Encoder decoding.  Even on the falling edge of Phase B, the counter should change value.  If Phase A is high, then it should decrease, if Phase A is low, then it should increase.