Encoder data: How to interpret encoder data from a motor going into the PIC16F877?
I'm not sure exactly how to interpret encoder data from a motor going into the PIC16F877. From the data sheet it looks like there is a channel A and B that generate square pulses that are 90 degrees out of phase with each other. I think they're out of phase so you can determine the direction of rotation. There is also a channel 'I' but I'm not sure what that does. It says it's TTL compatible so I think I can directly feed it into the PIC on a pin configured for input. Then do I periodically just count how many pulses I get in a given time period? It would be nice if I could get this process to run in the background because it seems like it would prevent the PIC from handling other tasks for a long time while it counts pulses. On the data sheet it says 512 lines per revolution. Is that the same thing as 512 pulses per revolution? Here is a link to the data sheet for the encoder I plan on using: #-Link-Snipped-# It's the IE2-512. Thanks for any programming tips or suggestions on how I go about doing this.
Replies
-
reachrkataRe: Encoder data: How to interpret encoder data from a motor going into the PIC16F877
An Encoder normally works like this.
1) Channel A is connected to a processor interrupt for LOW->HIGH transition.
2) When the interrupt is detected, the status of Channel B is read. If Channel B is LOW, this means that the encoder was turned one step in Clockwise. If Channel B is High, then the encoder was turned one step anticlockwise.
3) You can maintain a counter variable which counts +1 for each clockwise and -1 for each anticlockwise.
4) In the case of IE2-512, there are 512 encoder steps in 1 turn (360deg) of the encoder.
I hope this clarifies eveything.
-Karthik
๐ -
el3ktr1kRe: Encoder data: How to interpret encoder data from a motor going into the PIC16F877
Is the encoder continuously sending data and I just have to chose a time period when to sample the data or is the data sent at specified time intervals? If I have to chose the time interval that I'm counting the steps, do I use TMR1 to let me know how much time has passed? Thank you for your help. -
reachrkataRe: Encoder data: How to interpret encoder data from a motor going into the PIC16F877
No the encoder doesn't send data continuously. It only sends pulses when you turn it.
As I specified previously, you can maintain a counter to count the encoder turns in the Interrupt Service routine. In parallel, you can also configure an internal timer for sampling. After the timer time-out, just do what you want to do with the present counter value and then reset the counter to zero.
-Karthik -
KINETIC_JOULESRe: Encoder data: How to interpret encoder data from a motor going into the PIC16F877
-Is confused-
You are reading an archived discussion.
Related Posts
Hi, how many people here are from materials science discipline and have done project in materials science? Plz reply...;-)
hey guys
i'm doing a project in the field of ad hoc networks. i'm just a beginner and have no experience/knowledge in the field of networking/adhocs.
i hv searched a...
Dear High Voltage and Low Voltage Engineers,
Its really happy to meet all of us under this forum. I am GM having experince of 8 years in Industry and Edu....
hi.
if anybody has any links relating to " dtection of tampering in images" which can be implemented using MATLAB, please post them here...
any help will be highly appreciated...
How we can create an installation package for a project of visual basic. That means if i have a VB project ready and i want to make an installation package...