Hello all, I am trying to count some pulses in the 12f683 pic using pulsin command. is an external oscillator necessary to utilize the pulsin command in PBP? if not what defines are necessary to make it work because so far i can't make the pic read pulses. i keep reading "0" for the pulse width. thank you all for your help.
Jose
Define Osc 4 '4mhz
TRISIO = %000100
LCD var GPIO.0
T2400 con 396 '2400 baud
lowP VAR WORD 'falling edge
hiP VAR WORD 'rising edge
widthP VAR WORD 'pulse width
freqIn VAR GPIO.2 'input pulse
loop:
pulsin freqIN, 0 , lowP 'low pulse width
pulsin freqIN, 1 , hiP 'get high pulse width
widthP = lowP + hiP
pause 5:serout2 LCD, T2400, ["start", 1, DEC (lowP), ",", DEC (hiP), ",", DEC (widthP), 0]
pause 500
goto loop
'===================
'===pulse being sent====
Define Osc 4 '4mhz
TRISIO = %000000
pulse VAR GPIO.0
loop:
HIGH pulse
pause 1
LOW pulse
pause 1
goto loop
Bookmarks