I am doing a project where i need to measure the speed of my motor shaft. I am using a rotary optical encoder which will give a 0 logic level each time one of the 8 slots cuts the light beam. This output will enter a PIC 16F877 micro-controller. I need to do programming in mikroBasic to calculate the speed. I have a few vague ideas. Can you please help me to guide me towards the development of the program?
Proposed schema:
1. Input signal from sensor in pic
2. start internal timer of PIC
3. count pulses for a specific time
4. calculate speed
My problem also in how to start the internal time of the PIC. Kindly help me.
I may sugest you to use dsPIC instead PIC.
That´s because it have incremental built-in hardware module, wich allows the firmware to take account of encoder position without need to count incoming pulses, but reading a specific counter register.
Thanks andre_teprom.... However i do not have a dsPIC available and the time i will get it if purchases will be too close to my submission deadline...What i have on hand is a PIC 16F877... I need to manage with this one only....
Thanks a lot for the advice though.
Kind regards
Kunal
---------- Post added at 11:11 ---------- Previous post was at 11:02 ----------
Thanks a lot for your usual help and cooperation bigdogguru.... I will go through the link and get back once done to update you with progress on the topic.