Quadrature decoding is a means of increasing the accuracy of the encoder by counting every state change from both channels in one cycle. Both channel A and channel B produce two state changes (switching between high and low) per square wave cycle. The quadrature decoder circuit (shown on the right) uses logic gates to detect a state change on both the A and B channels and it compares the current state to the previous one. If it senses that the encoder is moving forward, it will send out a pulse on either the Count Up output; and conversely if it senses backwards movement it will send a pulse on the Count Down output. All the user needs to do is keep track of how many pulses occur on which line to know how many increments the encoder has moved.