DPRG List  

DPRG: Optical encoders Help!! Also NMIY0031 does not do interrupts!!

Subject: DPRG: Optical encoders Help!! Also NMIY0031 does not do interrupts!!
From: Ed Koffeman edk at cyberramp.net
Date: Tue Feb 17 19:39:30 CST 1998

This subject was recently a topic on another news list:

>After having a good look at the HCTL2016 chip... I think I can do the whole
>job with it alone (ok one for each stream...)
        There's also the LS7166 it's a quadrature decoder and 24 bit Up/down
and a count frequency up to 10 Mhz !!!

Another option is to do a dedicated cheap PIC.

Ed Koffeman

- -----Original Message-----
>From: Kipton Moravec <kmoravec at usa.net>
To: dprglist at dprg.org <dprglist at dprg.org>
Date: Tuesday, February 17, 1998 2:15 PM
Subject: DPRG: Optical encoders Help!! Also NMIY0031 does not do

>Does anyone have any real experience using an optical encoder to count
>up and down?
>I thought this was going to be a no brainer. The optical encoder has two
>channels, A and B.  The theory is very simple.  One channel is the clock
>and the other channel is the direction.  If you go in one direction
>(clockwise), when the clock pulse transitions from low to high, the
>direction channel is high.  When the encoder is turned in the other
>direction the direction channel is low.
>In theory, all you have to do is hook one channel to the clock of a
>counter and the other channel to the up/dn count of a counter like the
>74LS191.  In reality it doesn't work that way. (O.K. I had to add a
>pullup resistor and a cap and a schmitt trigger to debounce.)
>I first tried this in VHDL (for my Xilinx part) and was getting weird
>results.  So I tried discrete parts.  I pulled the '191 out of my box of
>parts and found it would count up O.K. but it acted weird counting
>down.  Sometimes it would skip, sometimes it would count up when it
>should count down.
>Fortunately I had a HP Logic Analyzer.  It turned out that when the
>direction bit made a transition from low to high it affected the count,
>usually in the second bit! After looking closer at the TTL Data book,
>all the waveform examples had the Clock Enable disabled when the
>direction made a transition. So somehow I would have to disable the
>count enable while the direction bit made the transitions. This smelled
>like more resistors, caps, and schmitt triggers...
>Deciding not to screw with it anymore, I knew I had some interrupt lines
>free on my NMIY0031. I could read it with the 8051 and update the
>counter like it was a memory location.  After two days of not getting
>the interrupts to work, I called New Micros and found out that they did
>not redirect the interrupt vector table from the Monitor Memory (0000h -
>7FFFh) to the user memory (8000h - FBFFh), as their code in COMMON51.C
>implied. As a result, you can not do interupts on the NMIY0031 if the
>monitor chip is in. That SUCKS.
>Does anyone have any good suggestions?  I am so far behind and a lot of
>it has to do with this part that should be very simple! Counting up and
>down with an optical encoder.


More information about the DPRG mailing list