70208A

35
 Section 15. Quadrature Encoder Interface (QEI)  HIGHLIGHTS  This section of the manual contains the following major topics:  15.1 Introduction .................................................................................................................. 15-2  15.2 Control and Status Registers ....................................................................................... 15-  15.! "rogramma#le $igital %oise &ilters ............................................................................. 15-'  15. (uadrature $ecoder .................................................................................................... 15-)  15.5 1*-#it +p,$own "osition Counter............................................................................... 15-11  15.* +sing (I as an lternate 1*-#it Timer,C ounter........................................................ 15-15  15./ (I Interrupts............................................................................................................. 15-1*  15.' I,0 "in Control ........................................................................................................... 15-1/  15.) (I 0peration $uring "ower Saing odes ............................................................. 15-1'  15.13 ffects of a Reset........................................................... ............................................ 15-1'  15.11 Registers ssociated with (I................................................................................... 15-1'  15.12 $esign Tips ................................................................................................................ 15-23  15.1! Related pplication %otes............................................................... ........................... 15-21  15.1 Reision 4istor ......................................................................................................... 15-22  15  Encod  Quadrature (QEI)  er Interface 6 233/ icrochip Technolog Inc. $S/323'-page 15-1  

Transcript of 70208A

Page 1: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 1/35

  Section 15. Quadrature Encoder Interface (QEI)

  HIGHLIGHTS

  This section of the manual contains the following major topics:  15.1 Introduction ..................................................................................................................

15-2

  15.2 Control and Status Registers .......................................................................................15-

  15.! "rogramma#le $igital %oise &ilters .............................................................................

15-'  15. (uadrature $ecoder ....................................................................................................

15-)

  15.5 1*-#it +p,$own "osition Counter...............................................................................

15-11  15.* +sing (I as an lternate 1*-#it Timer,Counter........................................................

15-15

  15./ (I Interrupts.............................................................................................................

15-1*  15.' I,0 "in Control ...........................................................................................................

15-1/  15.) (I 0peration $uring "ower Saing odes .............................................................

15-1'

  15.13 ffects of a Reset.......................................................................................................15-1'

  15.11 Registers ssociated with (I...................................................................................

15-1'

  15.12 $esign Tips ................................................................................................................15-23

  15.1! Related pplication %otes..........................................................................................15-21  15.1 Reision 4istor .........................................................................................................

15-22

  15

  Encod

  Quadrature

(QEI)

  er Interface

6 233/ icrochip Technolog Inc.

$S/323'-page 15-1 

Page 2: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 2/35

 

dsPIC33F Fami! "eference #anua

  15.1

  I$T"%&'CTI%$

  The (uadrature ncoder Interface 7(I8 module proides the interface to incremental

encoders for o#taining mechanical position data. (uadrature encoders9 also nown as

incremental encoders or optical encoders9 detect position and speed of rotating motion sstems.(uadrature encoders ena#le closed-loop control of motor control applications9 such as Switched

Reluctance 7SR8 motor and C Induction otor 7CI8.

tpical ;uadrature encoder includes a slotted wheel attached to the shaft of the motor

and an emitter,detector module that senses the slots in the wheel. Tpicall9 three outputchannels9 "hase 7(<89 "hase = 7(=<8 and Inde< 7I%$><89 proide information on the

moement of the motor shaft9 including distance and direction.

The "hase and "hase = channels hae a uni;ue relationship. If "hase leads "hase =9the direction of the motor is deemed positie9 or forward. If "hase lags "hase =9 the direction

of the motor is deemed negatie or reerse. The Inde< pulse occurs once per mechanical

reolution and is used as a reference to indicate an a#solute position. &or a relatie timingdiagram of these three signals9 refer to &igure 15-1.

The ;uadrature signals produced # the encoder can hae four uni;ue states 7319 339 13

and 118 that reflect the relationship #etween (< and (=<. &igure 15-1 shows these states for one count ccle. The order of the states reerses when the direction of trael changes.

The ;uadrature decoder increments or decrements the 1*-#it +p,$own Counter

7"0S<C%T8 for each change of state. The counter increments when (< leads (=< and

decrements when (=< leads (<.

Fiure 151*

  Quadrature Encoder Interface Sinas

1 C!ce

  &orward Trael

  QE+,

  QE-,

  I$&,

  31 33

  13  11  Reerse Trael

  QE+,

  QE-,

  I$&,

  11

  13

Page 3: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 3/35

  33

  31

  $ote*

  ach ds"IC!!& deice ariant can hae one or more (I modules. n ?<@ used in the

names of pins9 control,status #its and registers denotes the particular (I module num#er 7< A 1

to 28. &or more details9 refer to the specific deice data sheets.$S/323'-page 15-2

  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

  The (I consists of decoder logic to interpret the "hase 7(<8 and "hase = 7(=<8

signals and an up,down counter to accumulate the count. $igital noise filters on the inputs

condition the input signal. &igure 15-2 is a simplified #loc diagram of the (I module.

The (I module includes:  B Three input pins for two phase signals and inde< pulse

  B "rogramma#le digital noise filters on inputs

  B (uadrature decoder proiding counter pulses and count direction

  B 1*-#it up,down position counter 7"0S<C%T8  B Count direction status

  B <2 and < count resolution  B Two modes of position counter reset:

  - a<imum Count 7><C%T8 to reset the position counter 

  - Inde< 7I%$><8 pulse to reset the position counter   B eneral "urpose1*-#it Timer,Counter mode

  B Interrupts generated # (I or counter eents

  Fiure 15/*

  Quadrature Encoder Interface #odue Sim0ified -oc &iaram

Reset na#le 7"0SRS8

  Cloc 

  TCD  $iider 

  Reset

  CE0CF   3

  $igital

  1*-=it +p,$own

  (<  Counter 

  %oise

  7"0S<C%T8  1

  &ilter 

  Comparator,  (+E

  $igital

  (uadrature

  Gero $etect

Page 4: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 4/35

  (=<

  $ecoder 

  %oise  Eogic

  $IR 

  &ilter   a< Count Register 

  7><C%T8

  $igital  I%$><

  %oise

  &ilter 

  +"$%<  $ote*

  Inde< pulse reset is possi#le onl if (IH2:3 A 133 or 113

  15

  Encoder InterfaceQuadratuare

(QEI)

  6 233/ icrochip Technolog Inc.

$S/323'-page 15-!

  dsPIC33F Fami! "eference #anua

  15./

  C%$T"%L +$& ST+T'S "EGISTE"S

  The (I module has four user-accessi#le registers. &igure 15-! shows that the registers

are  accessi#le in either #te or word mode. These registers are:

  B Contro2Status "eister (QEI,C%$) 

This register controls (I operation and proides status flags for the state of the module.B &iita Fiter Contro "eister (&FLT,C%$) 

This register controls digital input filter operation.

B Position Count "eister (P%S,C$T) This register allows reading and writing of the 1*-#it position counter.

B #a,imum Count "eister (#+,C$T) 

This register holds a alue that is compared to the "0S<C%T counter in some operations.

  $ote*

  The "0S<C%T register allows #te accessesJ howeer9 reading the register in #te mode

can result in partiall updated alues in su#se;uent reads. ither use word mode reads,writes or

ensure that the counter is not counting during #te operations.

Fiure 153*

  QEI Prorammers #ode

  (I<C0% 71* #its8  =it 15

  =it 3

  $&ET<C0% 7' #its8

  =it /

Page 5: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 5/35

  =it 3

  "0S<C%T 71* #its8

  =it 15  =it 3

  ><C%T 71* #its8

  =it 15  =it 3

  The (I<C0% 7Register 15-18 and $&ET<C0% 7Register 15-28 registers define the (I

module control and digital filter control.$S/323'-page 15-

  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

 

"eister 151*

  QEI,C%$* QEI Contro "eister

  R,K-3

  +-3  R,K-3

  R-3  R,K-3

  R,K-3

  R,K-3  R,K-3

  C%TRR 

  L 

  (ISI$E  I%$>

  +"$%

  (IH2:3 #it 15

  #it '

  R,K-3  R,K-3

  R,K-3

  R,K-3

  R,K-3  R,K-3

  R,K-3

  R,K-3  SK"=

  "C$0+T

  T(T(1)

  T(CF"SH1:3 (1)

  "0SRS

  T(CS(1)

  +$SRC(1)

Page 6: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 6/35

  #it /

  #it 3

  Leend*

  R A Reada#le #it

  K A Krita#le #it

  + A +nimplemented #it9 read as ?3@  -n A Malue at "0R 

  ?1@ A =it is set

  ?3@ A =it is cleared  < A =it is unnown

  #it 15

  C$TE""* Count rror Status &lag #it

  1 A "osition count error has occurred3 A %o position count error has occurred

7C%TRR flag onl applies when (IH2:3 A 113 or 1338

  #it 1

  'nim0emented* Read as ?3@  #it 1!

  QEISI&L* Stop in Idle ode #it  1 A $iscontinue module operation when deice enters Idle mode

  3 A Continue module operation in Idle mode

  #it 12  I$&E* Inde< "in State Status #it 7Read-onl8

  1 A Inde< pin is high

  3 A Inde< pin is low

  #it 11  'P&$* "osition Counter $irection Status #it

  1 A "osition counter direction is positie 7N8

  3 A "osition counter direction is negatie 7-8  7Read-onl #it when (IH2:3 A 1<<8

  7Read,Krite #it when (IH2:3 A 3318

  #it 13-'  QEI#4/*6* (uadrature ncoder Interface ode Select #its 111 A (uadrature ncoder

Interface ena#led 7< mode8 with position counter reset # match 7><C%T8

  113 A (uadrature ncoder Interface ena#led 7< mode8 with Inde< "ulse reset of position

counter 131 A (uadrature ncoder Interface ena#led 7<2 mode8 with position counter reset #match 7><C%T8

  133 A (uadrature ncoder Interface ena#led 7<2 mode8 with Inde< "ulse reset of position

counter 311 A +nused 7odule disa#led8  313 A +nused 7odule disa#led8

  331 A Starts 1*-#it Timer 

  333 A (uadrature ncoder Interface,Timer off   #it /

  S7P+-* "hase and "hase = Input Swap Select #it

  1 A "hase and "hase = inputs swapped

  3 A "hase and "hase = inputs not swapped

Page 7: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 7/35

  #it *

  PC&%'T* "osition Counter $irection State 0utput na#le #it

  1 A "osition counter direction status output ena#le 7(I logic controls state of I,0 pin8 15

  3 A "osition counter direction status output disa#led 7%ormal I,0 pin operation8 Encoder

Interface

 #it 5  TQG+TE* Timer ated Time ccumulation na#le #it(1)

  Quadratuare

1 A Timer gated time accumulation ena#led  3 A Timer gated time accumulation disa#led

  (QEI)

  $ote 1* Khen configured for (I mode9 the T(T9 T(CF"S9 T(CS and +$SRC

 #its are ignored.6 233/ icrochip Technolog Inc.

$S/323'-page 15-5

  dsPIC33F Fami! "eference #anua

  "eister 151*  QEI,C%$* QEI Contro "eister (Continued)

  #it -!  TQC8PS41*6* Timer Input Cloc "rescale Select #its(1) 11 A 1:25* prescale alue

  13 A 1:* prescale alue

  31 A 1:' prescale alue  33 A 1:1 prescale alue

  #it 2

  P%S"ES* "osition Counter Reset na#le #it

  1 A Inde< pulse resets position counter3 A Inde< pulse does not reset position counter

7=it onl applies when (IH2:3 A 133 or 1138

  #it 1  TQCS* Timer Cloc Source Select #it(1)

  1 A <ternal cloc from pin (< 7on the rising edge8

3 A Internal cloc 7TCD8  #it 3

  '&S"C* "osition Counter $irection Selection Control #it(1)

  1 A (=< pin state defines position counter direction

  3 A Control,Status #it9 +"$% 7(I<C0%H1189 defines timer counter 7"0S<C%T8direction $ote 1* Khen configured for (I mode9 the T(T9 T(CF"S9 T(CS and +$SRC

 #its are ignored.

$S/323'-page 15-*  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

  "eister 15/*

  &FLT,C%$* &iita Fiter Contro "eister

  +-3

  +-3

  +-3

Page 8: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 8/35

  +-3

  +-3

  R,K-3  R,K-3

  R,K-3

  L   L 

  L 

  L   L 

  IMH1:3

CI$

  #it 15  #it '

  R,K-3

  R,K-3

  +-3  +-3

  +-3  +-3

  (0+T

  (CFH2:3 L 

  L 

  L 

  L   #it /

  #it 3

  Leend*

  R A Reada#le #it

  K A Krita#le #it

  + A +nimplemented #it9 read as ?3@  -n A Malue at "0R 

  ?1@ A =it is set

  ?3@ A =it is cleared

  < A =it is unnown  #it 15-11

  'nim0emented* Read as ?3@

  #it 13-)  I#941*6* Inde< atch Malue O These #its allow user software to specif the state of

the (< and (=< input pins during an Inde< pulse when the "0S<C%T register is to #e reset

In < (uadrature Count ode:  IM1 A Re;uired State of "hase = input signal for match on inde< pulse IM3 A

Re;uired State of "hase input signal for match on inde< pulse In <2 (uadrature Count ode:

  IM1 A Selects phase input signal for inde< state match 7"hase A 39 "hase = A 18

IM3 A Re;uired state of the selected phase input signal for match on inde< pulse #it '

Page 9: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 9/35

  CEI&* Count rror Interrupt $isa#le

  1 A Interrupts due to count errors are disa#led

  3 A Interrupts due to count errors are ena#led  #it /

  QE%'T* $igital &ilter 0utput na#le

  1 A $igital filter outputs ena#led on (<,(=<,I%$>< pins3 A $igital filter outputs disa#led 7normal pin operation8

  #it *-

  QEC84/*6* $igital &ilter Cloc $iide Select111 A 1:25* Cloc diide for (<,(=<,I%$><

113 A 1:12' Cloc diide for (<,(=<,I%$><

131 A 1:* Cloc diide for (<,(=<,I%$><

133 A 1:!2 Cloc diide for (<,(=<,I%$><311 A 1:1* Cloc diide for (<,(=<,I%$><

313 A 1: Cloc diide for (<,(=<,I%$><

331 A 1:2 Cloc diide for (<,(=<,I%$><

333 A 1:1 Cloc diide for (<,(=<,I%$>< #it !-3

  'nim0emented* Read as ?3@  15

  Encoder Interface

Quadratuare

(QEI)

  6 233/ icrochip Technolog Inc.

$S/323'-page 15-/

  dsPIC33F Fami! "eference #anua

  15.3

  P"%G"+##+-LE &IGIT+L $%ISE FILTE"S

  The (I module uses digital noise filters to reject noise on the incoming inde< and;uadrature phase signals. These filters reject low-leel noise and large9 short duration noise

spies that tpicall occur in motor sstems.

The filtered output signals can change onl after an input leel has the same alue forthree consecutie rising cloc edges. The result is that short noise spies #etween rising cloc

edges are ignored9 and pulses shorter than two cloc periods are rejected.

The rate of the filter clocs determines the low pass#and of the filter. slower filter cloc 

results in a pass#and rejecting lower fre;uencies. The filter cloc is the deice &CD clocdiided # a programma#le diisor.

Setting the $igital &ilter 0utput na#le 7(0+T8 #it in $igital Signal Control

7$&ET<C0%H/8 register ena#les the filter for (<9 (=<9 and I%$>< inputs. The $igital&ilter Cloc 7(CF8 #its 7$&ET<C0%H*:8 specif the filter cloc diisor used for the (<9

(=< and I%$>< channels.

&igure 15- is a simplified #loc diagram of the digital noise filter. &igure 15-5 shows therelationship #etween the incoming signal and the filtered output signal9 where three consecutie

cloc pulses alidate the input signal alue.

Fiure 15:*

  Sim0ified &iita $oise Fiter -oc &iaram

Page 10: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 10/35

  %on-&iltered

  3

  (n  &ilter 

  &iltered

  1  0utput

  (0+T

  P  (

  CF 

  (n

  F   $

  (

  $

  (  $

  (  $

  (

  pin  TCD

  CF 

  CF 

  CF   CF 

  CF 

  CF   CF 

  Cloc 

  $iider   TCD

  Circuit

  !

  (CFH2:3

$ote* ?n@ denotes the phase input9 or =.

Fiure 155*

  Sina Pro0aation T;rou; Fiter< 1*1 Fiter Coc &i=ide

TCD

  (n "in

  (n &ilter   $S/323'-page 15-'

  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

  15.:

Page 11: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 11/35

  Q'+&"+T'"E &EC%&E" 

  The ;uadrature decoder conerts the incoming filtered signals into count information.

The (I circuitr multiplies the resolution of the input signals # a factor of two or four 7<2 or<

  decoding8.

"osition measurement modes are selected when (uadrature ncoder Interface odeSelect 7(IH2:38 #its in the (uadrature ncoder Control 7(I<C0%H13:'8 register is set

7(IH2:3 A 3318.

Khen (I92:3 A 3319 the < measurement mode is selected9 and the (I logic clocsthe position counter on #oth edges of the "hase and "hase = input signals.

&igure 15-* shows that the < measurement mode proides for finer resolution data

7more position counts8 to determine the encoder position.

Fiure 15>*

  Quadrature &ecoder Sinas in ,: #ode

(<

  (=<

  countQcloc   "0S<C%T

  N1  N1

  N1

  N1  N1

  N1

  N1

  N1  N1

  N1

  -1  -1

  -1

  -1  -1

  -1

  -1

  -1  -1

  +"$%<

  Khen (IH2:3 A 3339 the <2 measurement mode is selected and the (I logic onlloos at the rising and falling edge of the "hase input for the position counter increment rate.

&igure 15-/ shows how eer rising and falling edge of the "hase signal causes the

 position counter to increment or decrement. The "hase = signal is still used to determine thecounter direction9 e<actl lie the < measurement mode.

Fiure 15?*

  Quadrature &ecoder Sinas in ,/ #ode

(<

Page 12: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 12/35

  (=<

  countQcloc 

  N1  N1

  N1

  N1  N1

  -1

  -1  -1

  -1

  "0S<C%T

  +"$%<  15

  Encoder Interface

Quadratuare

(QEI)  6 233/ icrochip Technolog Inc.

$S/323'-page 15-)  dsPIC33F Fami! "eference #anua

  15.:.1

  E,0anation of Lead2La Test

  The lead,lag test is performed # the (I logic to determine the phase relationship of the

(< and (=< signals and hence whether to increment or decrement the "0S<C%T register.

The

  Ta#le 15-1 clarifies the lead,lag test.

Ta@e 151*

  Lead2La Test &escri0tion

  Present

  Pre=ious

  Condition

  +ction

  Transition

  Transition

  (=

  (< leads (=< channel  Set +"$%<

  Increment "0SC%T

  (<  (=<

  (< lags (=< channel

  Clear +"$%<  $ecrement "0SC%T

(<

  $irection Change

  Toggle +"$%<

Page 13: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 13/35

  Increment or $ecrement "0SC%T

  (=

  (< lags (=< channel  Clear +"$%<

  $ecrement "0SC%T

(<  (=<

  (< leads (=< channel

  Set +"$%<  Increment "0SC%T

  (<

  $irection Change

  Toggle +"$%<  Increment or $ecrement "0SC%T

  (<

  (< lags (=< channel

  Clear +"$%<  $ecrement "0SC%T

(=<  (<

  (< leads (=< channel

  Set +"$%<  Increment "0SC%T

  (=

  $irection Change

  Toggle +"$%<  Increment or $ecrement "0SC%T

  (<

  (< leads (=< channel  Set +"$%<

  Increment "0SC%T

  (=  (<

  (< lags (=< channel

  Clear +"$%<

  $ecrement "0SC%T(=<

  $irection Change

  Toggle +"$%<  Increment or $ecrement "0SC%T

  15.:./

  Count &irection Status

  s preiousl mentioned9 the (I logic generates an +"$%< signal #ased on the "hase

and "hase = time relationship. The +"$%< signal can #e output on an I,0 pin. Setting the

"osition Counter $irection State 0utput na#le 7"C$0+T8 #it 7(I<C0%H*8 and clearing the

appropriate TRIS #it associated with the pin causes the +"$%< signal to drie the output pin. In

Page 14: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 14/35

addition to the output pin9 the state of this internal +"$%< signal is supplied to the Special

&unction register 7S&R8 #it (I<C0%H11 as a read-onl #it9 +"$%<.

15.:.3

  Encoder Count &irection

  The direction of ;uadrature counting is determined # the Input Swap Select 7SK"=8

 #it in the (uadrature ncoder Control 7(I<C0%H/8 register. If SK"= A 39 the "hase input is fed to the input of the ;uadrature counter and the "hase = input is fed to the = input of

the ;uadrature counter. Therefore9 as the "hase signal leads the "hase = signal9 the ;uadrature

counter is incremented on each edge. This condition 7(< signal leads the (=< signal8 isdefined as the forward direction of motion.

Setting the SK"= #it to a logic ?1@ causes the "hase input to #e fed to the = input of

the ;uadrature counter and the "hase = signal to #e fed to the input of the ;uadrature counter.

Therefore9 if the "hase signal leads the "hase = signal at the ds"IC!!& deice pins9 the"hase input to the ;uadrature counter lags the "hase = input. This condition is recognied as

rotation in the reerse direction9 and the counter is decremented on each ;uadrature pulse.

15.:.:

  Quadrature "ate  The reolutions per minute 7R"8 of the position control sstem can ar. The R"s

along with the ;uadrature encoder line count determine the fre;uenc of the (< and (=<input signals.

The ;uadrature encoder signals can #e decoded such that a count pulse is generated for

eer ;uadrature signal edge. This allows an angular position measurement resolution of up tofour times the encoder line count.

&or e<ample: *9333 R" motor utiliing a 3)* line encoder ields a ;uadrature count

rate of: 77*333,*38 U 73)*U88 A 1.*!' 4.

Eiewise9 a 139333 R" motor utiliing a '91)2 line encoder ields a ;uadrature countrate of: 7713333,*38 U 7'1)2U88 A 5.* 4.

&or the ma<imum cloc fre;uenc at the (< and (=< pins9 refer to the lectrical

Specifications section of the deice data sheet.$S/323'-page 15-13

  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

  15.5

  1>-IT 'P2&%7$ P%SITI%$ C%'$TE" 

  The 1*-#it +p,$own "osition Counter 7"0S<C%T8 counts up or down on eer count

 pulse generated # the (I logic. The counter then acts as an integrator whose count alue is proportional to position. The direction of the count is determined # the ;uadrature decoder.

The user software can e<amine the contents of the count # reading the "0S<C%T

register. The user software can also write to the "0S<C%T register to initialie a count.Changing the (I #its does not affect the position counter register contents.

15.5.1

  'sin t;e Position Counter

  The sstem can use position counter data in seeral was. In some sstems9 the position

count is accumulated consistentl and taen as an a#solute alue representing the total position

of the sstem.

&or a tpical e<ample9 assume that a ;uadrature encoder is affi<ed to a motor controlling

Page 15: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 15/35

the print head in a printer. In operation9 the sstem is initialied # moing the print head to the

ma<imum left position and resetting the "0S<C%T register. s the print head moes to the right9

the ;uadrature encoder #egins to accumulate counts in the "0S<C%T register. s the print headmoes to the left9 the accumulated count decreases. s the print head reaches the right-most

 position9 the ma<imum position count should #e reached. If the ma<imum count is less than 21*9

the (I module can encode the entire range of motion. If9 howeer9 the ma<imum count is morethan 21*9 the user software must capture the additional count precision. enerall9 to accomplish

this9 the module is set to a mode where it resets the counter when the count reaches a specified

ma<imum alue.Setting (IH2:3 A 331 ena#les modes where the >C%T register is used to reset

the position counter. Khen the counter reaches a predetermined ma<imum count while

incrementing or reaches ero while decrementing9 the count is reset. n interrupt is generated to

allow the user software to increment or decrement a software counter containing the ostSignificant #its 7S#s8 of the position count. The ma<imum count can #e 3<&&&& to ena#le a

full range of the (I counter and software counter9 or some smaller alue of significance9 such

as the num#er of counts for one encoder reolution.

Setting (IH2:3 A 333 ena#les a mode used in other sstems in which the positioncount can #e cclic. The position count references the position of the wheel within num#er of

rotations determined # the inde< pulse. &or e<ample9 a tool platform moed # a screw rod usesa ;uadrature encoder attached to the screw rod. In operation9 the screw ma re;uire fie and a

half rotations to achiee the desired position. The user software detects fie inde< pulses to count

the full rotations and uses the position count to measure the remaining half rotation. In thismethod9 the inde< pulse resets the position counter to initialie the counter at each rotation and

generates an interrupt for each rotation.

15

  Encoder Interface

Quadratuare

(QEI)

  6 233/ icrochip Technolog Inc.$S/323'-page 15-11

  dsPIC33F Fami! "eference #anua

  15.5./

  'sin #+C$T to "eset t;e Position Counter

  Khen the (IH2:3 #its are 3319 the position counter resets on a match of the position

count with predetermined high and low alues. The inde< pulse Reset mechanism is not used.

&or this mode9 the position counter Reset mechanism operates as follows 7for relatedtiming details9 refer to &igure 15-'8:

  B If the encoder is traelling in the forward direction 7(< leads (=<89 and the alue

in the "0S<C%T register matches the alue in the ><C%T register9 "0S<C%T resets to eroon the ne<t occurring ;uadrature pulse edge that increments "0S<C%T. +n interru0t e=ent is

enerated on t;is roo=er e=ent

  B If the encoder is traelling in the reerse direction 7(=< leads (<89 and the alue inthe "0S<C%T register counts down to ero9 the "0S<C%T register is loaded with the alue in

the ><C%T register on the ne<t occurring ;uadrature pulse edge that decrements "0S<C%T.

+n interru0t e=ent is enerated on t;is underfoA e=ent

  Khen using ><C%T as a position limit9 remem#er the position counter counts at

Page 16: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 16/35

either <2 or < of the encoder counts. &or standard rotar encoders9 the appropriate alue to write

to ><C%T is % O 1 for < position mode and 2% O 1 for <2 position mode9 where % is the

num#er of counts per reolution of the encoder.&or a#solute position information where the range of the sstem e<ceeds 21*9 it is also

appropriate to load a alue of 3<&&&& into the ><C%T register. The module generates an

interrupt on rolloer or underflow of the position counter.Fiure 15B*

  "oo=er2"ounder "eset'02&oAn Position Counter

(<  (=<

  countQcloc 

  3331 3332 333! 333 3335 333* 3333 3331 3332

  333!  3332 3331 3333 333* 3335 333 333! 3332 3331

  "0S<C%T

  +"$%<

  333*  ><C%T

  "0S<C%T A ><C%T  "0S<C%T A 3333

  enerate (I Interrupt

  enerate (I Interrupt  "0S<C%T set to 3333

  "0S<C%T set to ><C%T

  $S/323'-page 15-12

  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

  15.5.3

  'sin Inde, to "eset t;e Position Counter

  Khen (IH2:3 A 3339 the inde< pulse resets the position counter. &or this mode the

 position counter reset mechanism operates as follows 7for related timing details9 refer to &igure

15-)8:  B The position count is reset each time an inde< pulse is receied on the I%$>< pin

  B If the encoder is traelling in the forward direction 7(< leads (=<89 "0S<C%T is

reset to ?3@

  B If the encoder is traelling in the reerse direction 7(=< leads (<89 the alue in the>C%T register is loaded into "0S<C%T

  Fiure 15*

  "eset @! Inde, #ode'02&oAn Position Counter

(uadrature

  1

  2  !

 

  1

  2

Page 17: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 17/35

  !

 

  1  2

  2

  1 

  !

  2  1

 

  !

  2  1

 

  !

  2  State

  (<  (=<

  I%$><

  countQcloc   "0S<C%T

  33! 33 335 33* 3333 3331 3332 333! 333

  3335

  333 333! 3332 3331 3333 33* 335 33 33! 332 331 333  +"$%<

  enerate (I Interrupt

  Recognie Inde<  "0S<C%T set to ><C%T

  enerate (I Interrupt

  Recognie Inde<  "0S<C%T set to 3333

  Kheel Reerse

15.5.!.1

  I%$> "+ES $TCTI0% CRITRI  Incremental encoders from different manufacturers use differing timing for the inde<

 pulse. The inde< pulse can #e aligned to an of the four ;uadrature states and can hae a pulse

width of a full ccle 7 ;uadrature states89 a half ccle 72 ;uadrature states8 or a ;uarter ccle 71;uadrature state8. Inde< pulses of a full ccle width or a half ccle width are normall termed

VungatedW and inde< pulses of a ;uarter ccle width are normall termed Vgated.W

Regardless of the tpe of inde< pulse proided9 the (I maintains smmetr of the countas the wheel reerses direction. This means the inde< pulse must reset the position counter at the

same relatie ;uadrature state transition as the wheel rotates in the forward or reerse direction.

&igure 15-) is an e<ample of how the first inde< pulse is recognied and resets

"0S<C%T as the ;uadrature state changes from to 1. The (I latches the state of this

Page 18: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 18/35

transition. n su#se;uent inde< pulse detection uses that state transition for the reset.

&igure 15-) also demonstrates that as the wheel reerses9 the inde< pulse again occursJ

howeer9 the reset of the position counter cannot occur until the ;uadrature state changes from 1to .

$ote*

  The (I inde< logic ensures that the "0S<C%T register is alwas adjusted at the 15  same position relatie to the inde< pulse9 regardless of the direction of trael.

Encoder Interface

15.5.!.2  I%$> TC4 ME+

  Quadratuare

The Inde< atch Malue 7IM8 control #its 7$&ET<C0%H13:)8 allow the user software

to select (QEI)

  the state of the (< and (=< input pins during an inde< pulse when the "0S<C%T

register is to #e reset 7refer to Register 15-28.

6 233/ icrochip Technolog Inc.

$S/323'-page 15-1!  dsPIC33F Fami! "eference #anua

  15.5.!.!  I%$> "+ES STT+S

  The Inde< "in State Status 7I%$>8 #it 7(I<C0%H128 proides the status of the logic

state on the inde< pin. This status #it is useful in position control sstems during the VhomingWse;uence9 where the sstem searches for a reference position. The I%$> #it indicates the status

of the inde< pin after the #it is processed # the digital filter 7if ena#led8.

15.5.!.

  +SI% T4 I%$> "I% %$ >C%T &0R RR0R C4CFI%  Khen the counter operates in Reset on Inde< "ulse mode9 the (I also detects the

"0S<C%T

  register #oundar conditions. This operation can detect sstem errors in the incrementalencoder sstem.

&or e<ample9 assume a wheel encoder has 133 lines. Khen used in < measurement mode

and reset on the inde< pulse9 the counter should count from 3 to !)) 73<31'8 and reset. If thealue of the "0S<C%T register eer achiees 3<&&&& or 3<31)39 a sstem error occurrs.

The content of the "0S<C%T register is compared with ><C%T N 19 if counting up9

and with 3<&&&&9 if counting down. If the (I detects one of these alues9 a position count error

condition can generate # setting the Count rror Status &lag 7C%TRR8 #it 7(I<C0%H158and optionall generating a (I interrupt.

If the Counter rror Interrupt $isa#le 7CI$8 control #it 7$&ET<C0%H'8 is cleared

7default89 a (I interrupt is generated when a position count error is detected. If the CI$control #it is set9 an interrupt does not occur.

The position counter continues to count encoder edges after detecting a position count

error. %o interrupt is generated for su#se;uent position count error eents until the C%TRR #it7(I<C0%H158 is cleared # the user software.

15.5.!.5

  "0SITI0% C0+%TR RST %=E

  The "osition Counter Reset na#le 7"0SRS8 #it 7(I<C0%H28 ena#les a reset of the

Page 19: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 19/35

 position counter when the inde< pulse is detected. This #it onl applies when the (I module is

configured for (IH2:3 A 133 or 113.

B If the "0SRS #it is set to ?1@9 the position counter is reset when the inde< pulse isdetected

  B If the "0SRS #it 7(I<C0%H28 is set to ?3@9 the position counter is not reset when

the inde< pulse is detected. The position counter continues counting up or down and is reset onthe rolloer or underflow condition. The (I continues to generate interrupts on the detection of

the inde< pulse

  $S/323'-page 15-1  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

  15.>

  'SI$G QEI +S +$ +LTE"$+TE 1>-IT TI#E"2C%'$TE" 

  Khen the (I module is configured with (IH2:3 A 3319 the (I module is

configured as a 1*-#it timer,counter. &igure 15-13 shows the setup and control for the au<iliar

timer is accomplished through the (I<C0% register.

The (I timer functions similarl to the other ds"IC!!& timers. &or a general discussionof timers9 refer to Section 11. DTimers .

Khen configured as a timer9 the "0S<C%T register seres as a timer register similar tothe TRn registers of the eneral "urpose 7"8 timers. The ><C%T register seres as a

 period register similar to the "Rn registers of the " timers. Khen a timer,period register match

occurs9 the (I& flag is asserted.

$ote*

  Changing operational modes9 for e<ample9 from (I to Timer or Timer to (I9 does not

affect the Timer,"osition Count Register contents.

Fiure 151*

  QEI as Timer2Counter -oc &iaram

T

  SC   T(

  T(

  T(CF"S  2

  Tc

  3 3

  "rescaler   ated

  3 1

  Tc  19 '9 *9 25*

  "rogramma#le

  Snchronie  T(T

  (<

  1 3

  $igital &ilter 

Page 20: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 20/35

  1 1

  T(T

  1  (I&

  $

  (  ent

&lag

  +$SRC  CF (

  3

  +"$%<

  3  1*-#it +p,$own Counter 

  "rogramma#le

  7"0S<C%T8

  (=<  1

  $igital &ilter   Reset

  Comparator,Gero $etect ;ual

  a< Count Register   7><C%T8

  15

  Encoder Interface

Quadratuare

(QEI)

  6 233/ icrochip Technolog Inc.

$S/323'-page 15-15  dsPIC33F Fami! "eference #anua

  15.>.1

  '02&oAn Timer %0eration

  +nlie most other timers9 the (I timer can increment or decrement.

B Khen the timer is configured to count up9 the timer 7"0S<C%T8 increments until the

count matches the period register 7><C%T8. The timer resets to ero and restarts

incrementing  B Khen the timer is configured to count down9 the timer 7"0S<C%T8 decrements until the

count matches the period register 7><C%T8. The timer resets to ero and restarts

decrementing  Khen the timer is configured to count down9 the following two general operational

guidelines must #e followed for correct operation:

  B The ><C%T register seres as the period match register9 #ut the desired match alueis deried from the starting count of 3<&&&&. &or e<ample9 a timer count of 3<1333 is desired for 

a match contdition.The period register must #e loaded with 3<&333

  B 0n a match condition9 the timer resets to ero

  The "osition Counter $irection Selection Control 7+$SRC8 #it 7(I<C0%H38

Page 21: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 21/35

Page 22: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 22/35

  Ta@e 15/*

  Quadrature Encoder #odue Pinout I2% &escri0tions

Pin $ame

  Pin T!0e

  -uffer T!0e

  &escri0tion  (<

  I

  ST  (uadrature encoder "hase input9 or 

  I

  ST

  u<iliar timer e<ternal cloc input9 or   I

  ST

  u<iliar timer e<ternal gate input

  (=<  I

  ST  (uadrature encoder "hase = input9 or 

  I

  ST  u<iliar timer up,down select input

  I%$><

  I

  ST  (uadrature encoder inde< pulse input

  +"$%<

  0  "osition up,down counter direction status9 (I mode

  Leend* I A Input9 0 A 0utput9 ST A Schmitt Trigger 

  Ta@e 153*

  #odue I2% #ode Functions

ET

  QE-,

  I$&,

  'P&$,

  QEI#4/*6

CS

  QE+,

  &%'T

  G+

  0in

  0in

  0in

  0in

Page 23: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 23/35

Page 24: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 24/35

  %, %, %, Input

7(<8

  Input(I

7(=<8

  Reset # count  1

  %, %, %, Input

7(=<8  Input

  0utput

  7(=<8

  7+"$%<8  1339 113

  3

  %, %, %, Input

7(<8  Input

  Input  (I

  7(=<8

  7I%$><8  Reset # inde<

  1

  %, %, %, Input

7(<8  Input

  Input

  0utput  7(=<8

  7I%$><8 7+"$%<8

  $ote*

  mpt slot indicates pin not used # (I in this configurationJ pin controlled # I,0

  port logic.

15

  Encoder Interface

Quadratuare

(QEI)

  6 233/ icrochip Technolog Inc.$S/323'-page 15-1/

  dsPIC33F Fami! "eference #anua

  15.

  QEI %PE"+TI%$ &'"I$G P%7E" S+9I$G #%&ES

  15..1

  7;en t;e &e=ice Enters See0 #ode

  Khen the deice enters Sleep mode9 (I operations cease. The "0S<C%T register stops

Page 25: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 25/35

at the current alue. The (I does not respond to actie signals on the (<9 (=<9 I%$>< or

+"$%< pins. The (I<C0% register remains unchanged.

If the (I is configured as a timer,counter 7(IH2:3 A 33189 and the cloc is proidede<ternall 7T(CS A 189 the module ceases operation during Sleep mode.

Khen the module waes up9 the ;uadrature decoder accepts the ne<t transition on the

(< or (=< signals and compares that transition to the last transition #efore Sleep todetermine the ne<t action.

15../

  7;en t;e &e=ice Enters Ide #ode

  The module can enter a power-saing state in Idle mode9 depending on the Stop in Idle

ode 7(ISI$E8 #it 7(I<C0%H1!8 setting.

B If (ICSI$E A 19 the module enters the power saing mode9 with effects similar to

entering Sleep mode  B If (ICSI$E A 39 the module does not enter a power saing mode. The module

continues to operate normall while the deice is in Idle mode

  15.1

  EFFECTS %F + "ESET  Reset forces module registers to their initial Reset state. &or all initialiation and reset

conditions for (I module related registers9 refer to the (I<C0% register 7Register 15-18.The ;uadrature decoder and the "0S<C%T counter are reset to an initial state.

15.11

  "EGISTE"S +SS%CI+TE& 7ITH QEI

  Ta#le 15- lists the registers associated with the (I module.

$S/323'-page 15-1'

  6 233/ icrochip Technolog Inc.

6 2  Ta@e 15:*

  S0ecia Function "eisters +ssociated Ait; QEI(1)

  33/  $ame

  -it 15

  -it 1:

  -it 13

  -it 1/

  -it 11

  -it 1

  -it

  -it B

  -it ?

  -it >

  -it 5

  -it :

  -it 3

  -it /

  -it 1

  -it

Page 26: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 26/35

  9aue on +LL "eset

 

  (I1C0%  C%TRR 

  L 

  (ISI$E  I%$>

  +"$%

  (IH2:3SK"=

  "C$0+T

  T(T

  T(CF"SH1:3"0SRS

  T(CS

  +$SRC

  3333 3333 3333 3333  icro

  $&ET1C0%  L 

  L 

  L   L 

  L 

  IMH1:3

CI$  (0+T

  (CFH2:3

 L   L 

  L 

  L   ---- ---- ---- ----

  chi

  "0S1C%T

  "osition Count Register   3333 3333 3333 3333

  p Te

  >1C%T  a<imum Count Register 

  1111 1111 1111 1111

  ch  (I2C0%

  C%TRR 

  L 

  (ISI$E

Page 27: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 27/35

  I%$>

  +"$%

  (IH2:3SK"=

  "C$0+T

  T(T  T(CF"SH1:3

"0SRS

  T(CS  +$SRC

  3333 3333 3333 3333

  nolo

  $&ET2C0%  L 

  L 

  L 

  L   L 

  IMH1:3CI$

  (0+T

  (CFH2:3 L 

  L 

  L 

  L   ---- ---- ---- ----

  g

  "0S2C%T  "osition Count Register 

  3333 3333 3333 3333

  In  >2C%T

  a<imum Count Register 

  1111 1111 1111 1111

  S

  c.

e

  I&S!  L 

  L 

  L   L 

  L 

  (I1I&

  L 

Page 28: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 28/35

  L 

  L 

  L   L 

  L 

  L   L 

  L 

  L   3333 3333 3333 3333

  c

  I&S

  L   L 

  L 

  L 

  (I2I&  L 

  L   L 

  L 

  L   L 

  L 

  L 

  L   L 

  L 

  3333 3333 3333 3333  ti

  IC!

  L   L 

  L 

  L 

  L   (I1I

  L 

  L   L 

  L 

  L   L 

  L 

  L 

  L 

Page 29: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 29/35

  L 

  3333 3333 3333 3333

  o

  IC

  L 

  L   L 

  L 

  (I2I  L 

  L 

  L 

  L   L 

  L 

  L 

  L   L 

  L   L 

  3333 3333 3333 3333

  n

I"C1

  L 

  L 

  L   L 

  L 

  (I1I"H2:3 L 

  L 

  L   L 

  L 

  L 

  L   L 

  3133 3133 3133 3133

  15

  I"C1'

  L 

  (I2I"H2:3 L 

  L 

  L 

  L 

Page 30: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 30/35

  L 

  L 

  L   L 

  L 

  L   L 

  L 

  3133 3133 3133 3133  . Qu

  $ote 1* The registers associated with (I are shown for reference. The shaded #its are

not used for (I operation. &or the registers associated with other (I a

  modules9 refer to the deice data sheet. 0n man deices9 the (I pins are multiple<edwith analog input pins. The (I pins must #e configured as digital d

  pins using the $"C& control register.

rature Encoder Inte

  $  r

  S  f 

  /

  a

  32

  c

  3'

  e

  -

 

 p  (

  ag

  Q

  e 1

  E

  5-1

  I

  )

  )

  )

  EI

  (Q

  Encoder Interface

15

  re

adratu

  Qu

Page 31: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 31/35

  dsPIC33F Fami! "eference #anua

  15.1/

  &ESIG$ TIPS

  Question 1*

   I have initialized the QEI, but the POSxCNT register does not seem to

  change when uadrature signals are a!!lied to the QE"x#QE$x !ins%+nsAer*

  0n man deices9 the (I pins are multiple<ed with analog input pins. nsure that the

(I pins are configured as digital pins using the $<"C& control register.

Question /*

   &ow 'ast can m( uadrature signals be)

+nsAer*

  The answer depends on the setting of the filter parameters for the ;uadrature signals. &ordetails9 refer to the lectrical Specification section in the deice data sheet.

Question* 3

   *( encoder has a +X  Index Pulse and the count does not reset !ro!erl(%

+nsAer*  $epending on how the count cloc is generated9 and which ;uadrature state transition is

used for the inde< pulse9 a ;uarter ccle inde< pulse ma not #e recognied #efore the re;uiredtransition. To correct this9 use a filter on the ;uadrature clocs that has a higher filter prescaler

than that of the inde< pulse.

This has the effect of delaing the ;uadrature clocs somewhat9 allowing for properdetection of the inde< pulse.

Fiure 1511*

  "eset @! Inde, #ode (X Inde, Puse) '02&oAn Position Counter (uadrature

  2  !

 

  1  2

  !

    1

  2

  2

  1 

  !

  2  1

 

  !  2

  1

 

  !

Page 32: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 32/35

  2

  State

  (< &ilter   (=< &ilter 

  I%$><

  countQcloc   "0S<C%T

  33

  3333  3331

  3332

  333!

  3332  3331

  3333

  33

  33!  332

  +"$%<  enerate (I Interrupt

  enerate (I Interrupt

  "0S<C%T set to 3333  "0S<C%T set to ><C%T

  Recognie Inde<

  Recognie Inde<

  Kheel  Reerses

  $S/323'-page 15-23

  6 233/ icrochip Technolog Inc.

Section 15. Quadrature Encoder Interface (QEI)

  15.13

  "EL+TE& +PPLIC+TI%$ $%TES

  This section lists application notes that are related to this section of the manual. These

application notes ma not #e written specificall for the ds"IC!!& deice famil9 #ut the

concepts are pertinent and could #e used with modification and possi#le limitations. The current

application notes related to the (I module are:  Tite +00ication

$ote

  Sero Control of a $C-=rush otor 

  %5!2

  "IC1'C>>>,"IC1*C>>> $C Seromotor %*)*  +sing the ds"IC!3& for Mector Control of an CI

  %)3'

  $ote*

  &or additional pplication %otes and code e<amples for the ds"IC!!& deice famil9

Page 33: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 33/35

isit the icrochip we# site 7www.microchip.com8.

15

  Encoder Interface

Quadratuare

(QEI)

  6 233/ icrochip Technolog Inc.$S/323'-page 15-21

  dsPIC33F Fami! "eference #anua

  15.1:

  "E9ISI%$ HIST%"

  "e=ision + (#a! /?)

  This is the initial released ersion of this document.

$S/323'-page 15-22  6 233/ icrochip Technolog Inc.

&ocument %utine

  Section 15. (uadrature ncoder Interface 7(I8  15.1 Introduction &igure 15-1: (uadrature ncoder Interface Signals &igure 15-2:

(uadrature ncoder Interface odule Simplified =loc $iagram

15.2 Control and Status Registers &igure 15-!: (I "rogrammer@s odel Register 15-1:(I<C0%: (I Control Register Register 15-2: $&ET<C0%: $igital &ilter Control Register

15.! "rogramma#le $igital %oise &ilters &igure 15-: Simplified $igital %oise &ilter

=loc $iagram &igure 15-5: Signal "ropagation Through &ilter9 1:1 &ilter Cloc $iide15. (uadrature $ecoder &igure 15-*: (uadrature $ecoder Signals in < ode &igure

15-/: (uadrature $ecoder Signals in <2 ode 15..1 <planation of Eead,Eag Test Ta#le 15-1:

Eead,Eag Test $escription 15..2 Count $irection Status 15..! ncoder Count $irection 15..

(uadrature Rate15.5 1*-#it +p,$own "osition Counter 15.5.1 +sing the "osition Counter 15.5.2 +sing

>C%T to Reset the "osition Counter &igure 15-': Rolloer,Rollunder Reset-+p,$own

"osition Counter 15.5.! +sing Inde< to Reset the "osition Counter &igure 15-): Reset # Inde<ode-+p,$own "osition Counter

15.* +sing (I as an lternate 1*-#it Timer,Counter &igure 15-13: (I as

Timer,Counter =loc $iagram 15.*.1 +p,$own Timer 0peration 15.*.2 Timer Cloc Source15.*.! Timer ate 0peration

15./ (I Interrupts

  15.' I,0 "in Control Ta#le 15-2: (uadrature ncoder odule "inout I,0 $escriptionsTa#le 15-!: odule I,0 ode &unctions

15.) (I 0peration $uring "ower Saing odes 15.).1 Khen the $eice nters Sleepode 15.).2 Khen the $eice nters Idle ode

15.13 ffects of a Reset  15.11 Registers ssociated with (I Ta#le 15-: Special &unction Registers ssociated

with (I718

15.12 $esign Tips &igure 15-11: Reset # Inde< ode 7)3Y Inde< "ulse8 O +p,$own"osition Counter

15.1! Related pplication %otes

Page 34: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 34/35

  15.1 Reision 4istor

 

Page 35: 70208A

8/9/2019 70208A

http://slidepdf.com/reader/full/70208a 35/35