CrazyEngineers Forum

Turn The Screws!

Open your eyes, look in front, look at the back, look at any angle and you will see something that is an engineer's creation.

Engineers have been making things possible that others could only imagine. It perfectly makes sense to have a common place for engineers from around the world where they can share ideas, innovate, & help each other. Engineers are eternal, with the younger at 62 & the youngest at 17, the CEan gang consists of working professionals, students, entrepreneurs, CEOs, professors, geeks & nerds.

Need we say more? Click Here To Join The Gang!
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Electrical & Electronics Engineering
Reply

  #1 (permalink)
Old 28th June 2008, 12:08 AM
CE - Apprentice
 
I'm a Crazy Electrical Engineer
Join Date: 24th June 2008
Posts: 15
Default 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: http://www.micromo.com/uploadpk/IE2-512_MME.pdf It's the IE2-512. Thanks for any programming tips or suggestions on how I go about doing this.
el3ktr1k is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)
Old 28th June 2008, 01:09 PM
CE - Regular Member
 
reachrkata's Avatar
 
I'm a Crazy Electronics Engineer
Join Date: 4th November 2006
Posts: 74
Talking Re: 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
reachrkata is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 29th June 2008, 02:50 AM
CE - Apprentice
 
I'm a Crazy Electrical Engineer
Join Date: 24th June 2008
Posts: 15
Default Re: 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.
el3ktr1k is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)
Old 2nd July 2008, 11:20 PM
CE - Regular Member
 
reachrkata's Avatar
 
I'm a Crazy Electronics Engineer
Join Date: 4th November 2006
Posts: 74
Arrow Re: 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
reachrkata is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)
Old 3rd July 2008, 04:27 AM
CE - Addict
 
KINETIC_JOULES's Avatar
 
I'm a Crazy Electrical & Electronics Engineer
Join Date: 17th June 2008
Location: Monroe, Louisiana. United States
Posts: 345
Default Re: Encoder data: How to interpret encoder data from a motor going into the PIC16F877

-Is confused-
__________________
I reject your reality and substitute it with my own. . .
▌║││║█║▌│║│█║▌█│║▌▌║│││  
11 0011 10101 10101 1100 11
KINETIC_JOULES is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 05:16 PM.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.Ad Management by RedTyger