PDA

View Full Version : Need help with 16f877a.



Bertrand
- 16th September 2015, 13:49
Hey guys, i am new to these forums but i can already tell there are a lot of knowledgable people around and i am more than excited to learn more and more every day. So, introductions aside my first question is:
How to measure the width (duration) of incoming impulse on one of the nodes on PIC 16f877a in milliseconds range ?

Thx a lot in advance.

peterdeco1
- 16th September 2015, 14:30
Hi. I did this a few years ago with a 12F675.
START:
Clear
PulsIn GPIO.3,1,WIDTH 'LOOKING FOR A HIGH PULSE
IF WIDTH > 490 AND WIDTH < 510 Then High GPIO.4 'led5 LOOKING FOR 5MS
IF WIDTH >590 AND WIDTH < 610 Then High GPIO.2 'LED6
IF WIDTH >690 AND WIDTH < 710 Then High GPIO.1 'LED7
IF WIDTH >790 AND WIDTH < 810 Then High GPIO.0 'LED8
IF WIDTH > 1800 AND WIDTH < 2200 Then LET GPIO = 0 'OFF ALL LED'S
GoTo START