Re: Absolute to Incremental
Posted by
pwdober
on 2003-12-04 06:32:52 UTC
--- In CAD_CAM_EDM_DRO@yahoogroups.com, "irfan_younis"
<irfan_younis@y...> wrote:
Yes, I think it can be done, and fairly cheaply with a high speed
microcontroller, but it will take some programming.
BCD outputs may have glitches - it isn't a "clean" code like gray
code, so after a sample, first deglitch the code. For a rotary
encoder, (unless you aren't sampling fast enough) the only valid
codes are 1) the same as the last sample, 2) last sample plus one, 3)
the last sample minus one, or 4) the wrap-around code (code decimal
10 >> to code decimal 0, and visa versa). Ignore any sample that
isn't one of these.
Once you know if the code is the same, plus one, or minus one,
then "build" the quadrature output, maybe using some kind of state
machine. For example, if the current quadrature output is encoded so
that the "up" direction causes quadrature codes 00, then 01, then 11,
then 10, then 00, etc., and if the current output code happens to be
01, then if you sample a "plus one" new code, the new output would
change to 11.
This explanation is simplistic and incomplete, but it might get you
started.
Phil Doberenz
<irfan_younis@y...> wrote:
> Dear users,Irfan,
> I would like to convert Absolute rotary encoder BCD output to
> Incremental TTL output. Any body can help me in this case and can
> tell me circuit for it.
>
> Regards,
>
> Irfan
Yes, I think it can be done, and fairly cheaply with a high speed
microcontroller, but it will take some programming.
BCD outputs may have glitches - it isn't a "clean" code like gray
code, so after a sample, first deglitch the code. For a rotary
encoder, (unless you aren't sampling fast enough) the only valid
codes are 1) the same as the last sample, 2) last sample plus one, 3)
the last sample minus one, or 4) the wrap-around code (code decimal
10 >> to code decimal 0, and visa versa). Ignore any sample that
isn't one of these.
Once you know if the code is the same, plus one, or minus one,
then "build" the quadrature output, maybe using some kind of state
machine. For example, if the current quadrature output is encoded so
that the "up" direction causes quadrature codes 00, then 01, then 11,
then 10, then 00, etc., and if the current output code happens to be
01, then if you sample a "plus one" new code, the new output would
change to 11.
This explanation is simplistic and incomplete, but it might get you
started.
Phil Doberenz
Discussion Thread
irfan_younis
2003-12-03 06:44:52 UTC
Absolute to Incremental
pwdober
2003-12-04 06:32:52 UTC
Re: Absolute to Incremental