MDrive/MForce – Avoiding encoder overflow

In MDrive applications that require continuous slew, such as pumps or fans, and encoder mode is enabled, a stall error will occur when the encoder counter overflows. An easy way to avoid this is to use trip on position (Tp) to reset the position counter occasionally. The sample program demonstrates the use of Tp and sets a Pause / Resume input and a Fault output.

'*** This program uses a trip on position to
'*** reset the position counter every 100000
'*** encoder counts.

Ee=1          'enable encoder
P=0           'init pos counter
S1=6,0,0      'configure as pause/resume
S4=18,0,0     'configure as fault output

PG 1
LB su
 Tp 100000,fj 'on position trip call fj
 Te=2         'enable trip
 SL 3000      'continuous slew
 H
 E            'program end
LB fj
 P=0          'reset postion counter
 PR "reset"   'just here to show it's been called
 Te=2         'reenable position trip
 RT           'return

PG
S

Download Encoder Overflow .mxt file
(color-coded in IMS Terminal)

 

> Motion Control Code Index