Skip to content

Rotary encoder with AXL F CNT2 INC2 1F - 2688093 and AXC F 2152

I need to keep track of a quadrature encoder position.  Initially, I connected the quadrature signals to two inputs on a AXL F DI8/1 DO8/1 (with some external stuff to level shift the 0 and 5v levels out of my quadrature encoder to 0 and 24 volts to make the DI8 happy).  I wrote some structured text to compare these inputs to the previous state of these inputs and increment or decrement a UDINT variable accordingly.  Made this code fire every 1ms.  Seemed to work really well, but I need to be able to capture faster signals.  The AXL F CNT2 INC2 seems to be just the hardware to do this.

Fiddled with the parameters in PLCnext for the CNT2 INC2 module.  Channel activation:  active, axis type:  round, encoder type: asymmetrical (I only have the A and B outputs hooked up right now, though I have tested with this parameter at "symmetrical" and the complimentary outputs also connected).  I connected the quadrature encoder to the CNT2 INC2.  Put an oscilloscope the A and B inputs and rotated the encoder.  Scope shows nice pulses for both channels (high > 4 volts, low < 0.5v) when I rotate the encoder shaft.  I like that the CNT2 INC2 has a 5 volt supply for the encoder.  I was hoping for the position unsigned32 data item to increment or decrement as I rotate the encoder.  So far, I'm not seeing that.  I think that I have the encoder attached properly.  If I remove one of the encoder inputs, the red LED on the module illuminates and the Error INC1 shows "TRUE" in PLCnext Engineer.  When I replace the wire, the LED turns off and Error INC1 goes to FALSE.  The Position INC1 stays at zero when I rotate the encoder shaft.  The 02 and 12 LEDs stay off (they should indicate counting up or down).  The "diagnostics" section of the 2152 webpage shows green 0x0000 for the SXL F CNT2 INC2 1F.

My 2152 is running 2020.0 LTS.  CNT2 INC2 hardware version:  2019-03-26; 05, firmware version: 2017-06-01; V1.22.

 

...an hour later, I was experimenting with CNT2 INC2 parameters.  The default "modulo value for rotary axes" of 1 was causing me problems.  Seems like the position value incremented then MOD this value, which was always zero.  Changed this to 2**32-1.

Sign In or Register to comment.