Directional pulse Counter

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
sysprofessional
Posts: 54
Joined: Sat Oct 26, 2013 7:16 pm
Has thanked: 28 times
Been thanked: 4 times
Contact:

Directional pulse Counter

Post by sysprofessional »

Hello,

I had design a high speed pulse counter using tmr0 external interrupt almost a year ago.That can count 14KHz pulse (840000 RPM). It is working perfectly.

Now i want to design reverse forward pulse counter.My first counter is working with single proximity sensor (Metal Detector).i know there is one more

sensor required for directional counting.But have no idea how to use second sensor.I am using PIC16f887 with 12MHz Crystal and tmr0 external interrupt with

11718.750Hz interrupt frequency.

Please guide me,

Best regards

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Directional pulse Counter

Post by Benj »

Hello,

Encoders use a system called gray codes to allow you to count the number of ticks and the direction of movement. Basically only one bit is allowed to change state at a time.

Forwards
00
01
11
10

Backwards
00
10
11
01

if more than one bit changes at a time then you know you have missed a count and you can throw a warning that re-calibration is needed.

There are some encoder examples available from here and these will give you a positive or negative count depending on the direction of movement.
http://www.matrixtsl.com/wiki/index.php ... afda8467dc

This might not be enough to cover the range of frequencies you need but might be a good starting point.

User avatar
sysprofessional
Posts: 54
Joined: Sat Oct 26, 2013 7:16 pm
Has thanked: 28 times
Been thanked: 4 times
Contact:

Re: Directional pulse Counter

Post by sysprofessional »

Hello Benj,

Thanks your reply ,I am too much busy in my office work today's ,I 'll check it later and touch you again if i need help.

Best Regards

Tahir

Post Reply