CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Rotary Encoding for Amateurs

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sonicfire



Joined: 11 Feb 2007
Posts: 19
Location: Cedar Rapids

View user's profile Send private message

Rotary Encoding for Amateurs
PostPosted: Mon Feb 26, 2007 1:19 pm     Reply with quote

Does anybody have experience with rotary encoders for measuring a motor's rotational speed? I'm using a slotted-optocoupler as a rotary encoder to help me determine a dc motor's speed. The optocoupler delivers about 2V with no obstruction and about 0V when it's blocked. I could probably use an amplifier to make it 5V output if necessary. At any rate, I was wondering how I could write a reliable speed measurement program for the PIC 16F877. Does anyone know where there's some example code?

Thanks!
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Tue Feb 27, 2007 9:07 am     Reply with quote

Greetings,

A frequency example, 'EX_FREQC.C', ships with the CCS compiler (examples folder). I would include external circuitry to ensure the correct digital state (2V slightly low and will probably be indeterminate for a level change).

Consideration -> if your motor is stalled or not moving, the timer rollover conditon might need to checked

Cheers,
JMA
kd5uzz



Joined: 28 May 2006
Posts: 56

View user's profile Send private message

Interesting shaft encoder system.
PostPosted: Wed Feb 28, 2007 4:23 pm     Reply with quote

This doesn't help you with code, but it is a neat system.
I think I'm going to employ something similar to this in my next project...
http://www.seattlerobotics.org/encoder/200109/dpa.html
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group