Joined: 11 Feb 2007 Posts: 19 Location: Cedar Rapids
Rotary Encoding for Amateurs
Posted: Mon Feb 26, 2007 1:19 pm
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
Posted: Tue Feb 27, 2007 9:07 am
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
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