June 19, 1997 Controller easily evaluates 2-bit gray codeWilliam Grill, NavRadio Corp, Littleton, COPaired with a simple controller, 2-bit quadrature, gray-encoded rotary switches can easily provide continuous indexing functions for incrementing/decrementing and other applications. For example, the eight-pin 12C508 controller (Microchip Technology, Chandler, AZ) can evaluate the encoder's outputs approximately every 120 µsec using the controller's internal 4-MHz clock (Figure 1a). Even in small quantities, the 12C508 costs $1.50 and thus provides an inexpensive and small design for this application. The coded processes use a debounce qualified state table requiring two identical, consecutive readings before performing the incrementing or decrementing register's maintenance and output. (Click here to download the file from DI-SIG, #2048.) Designed for the 2-bit gray-code encoder sequence (Figure 1b), using a table to provide the state-sequence processing allows you to modify the design to accommodate other encoder output sequences. These sequences include 2-bit binary and 2-bit nonquadrature gray-code encoders. Although the controller allows the implementation of many output protocols, the controller in this design broadcasts the maintained and tabulated position whenever the host requests this information by asserting a low at the controller's request line. The 8-bit, 2's complement value transmits the most significant bit first, with a low-true enable and synchronous clock (Figure 2). This serial format is the principal factor limiting the index rate to approximately 7000 indexes/sec (1/(120+20 µsec)). Code-literal variables modify the debounce period, allowing you to insert a fixed delay between encoder evaluations. The allowable delay ranges from 20 µsec to almost 0.2 sec using a 16-bit debounce counter scheme. (DI #2048) | |||||
| |||||
| |||||
| EDN Access | Feedback | Table of Contents | | |||||
Copyright © 1997 EDN Magazine, EDN Access. EDN is a registered trademark of Reed Properties Inc, used under license. EDN is published by Cahners Publishing Company, a unit of Reed Elsevier Inc. |