DPRG
DPRG List  



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

Subject: DPRG: Optical encoders Help!! Also NMIY0031 does not do interrupts!!
From: Eric B. Olsen robojoc at worldnet.att.net
Date: Tue Feb 17 20:11:36 CST 1998

Kip,

Optical encoders are difficult from A to Z.  They're even more difficult to
use once you get them working! ... since the application level can be quite
complex!

For what it's worth, here's some thoughts:

If I was using Xilinx, I'd never even consider using discrete parts again
when developing circuits for one!

In Xilinx, it should be easy to create circuits that can properly decode the
signals from your encoder.  Also, I use it is to bring out test signals to
test pins and measure what's going at any point in the circuit ... as I'm
sure you know.

As another point, I thinks it's most important to double verify the signal
format coming from the encoder carefully.  As you know, it's always the
careful qualification of the input signal that allows success when
developing an interface.

Of course, in the final anaysis, the encoder interface circuit should
support several hardware features, similar to timer modes in a micro, i.e.
reset functions and capture registers, .... so again, I think Xilinx is the
best candidate for solving this.

And so one can see ... I like Xilinx!

Eric Olsen



Kipton Moravec wrote:

> 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.
>
> Regards,
> Kip



- --

"Time will tell if the human race can handle the responsibility of it's own
evolution"

Spectronix, Inc.
Henderson, NV

Fax:
Email:  robojoc at postmaster.worldnet.att.net
Web-Site:  http://home.att.net/~robojoc/

------------------------------

More information about the DPRG mailing list