Jump to content

Recommended Posts

Does anyone have experience with interfacing an optical rotary encoder to a 16F628 or 16F877 using C2C?

 

Thanks!

Share this post


Link to post
Share on other sites
Does anyone have experience with interfacing an optical rotary encoder to a 16F628 or 16F877 using C2C?

 

Thanks!

 

Not sure if you're still looking for a solution, but I did quite a lot of this stuff long ago...

 

Optical encoders use slots with offset optical sensors so that the pulses to two pins are in different sequences depending on direction.

e.g.

Clockwise might be:

A B

0 0

1 0

1 1

0 1

:

Anticlockwise:

A B

0 0

0 1

1 1

1 0

:

 

The most obvious method of using one optical output (e.g. 'A') to trigger an interrupt and the other ('B') to detect direction does not work well in practice because if the sensor is at any speed then the direction can't be read in time and 'B' will already have changed to its next state.

 

The simplest solution is to create a simple circuit with a latch that triggers on the rising edge of the 'A' input, and locks the state into the 'B'. This means you can still use 'A' to trigger an interrupt, but 'B' is always correctly reflecting the direction. This way you may lose a few pulses if the control is 'spun' too quickly, but at least it won't start detecting as reverse :)

 

Hope this helps, and that it's not too late for someone to find useful :)

 

Cheers,

Jason

Edited by jsobell

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...