there's probably many method. but did you tried with a sampling time of 10ms with a range of 68 to 82?
Where the pulses cme from? did you monitor it to see if they're clean with the right amplitude?
Before thinking of using internal counter or interupt, can you try the following and post your result?
Code:
' Pic 16f84 at xtal 4 Mhz. WDT off PTU off'
' Detecting 7.5Khz with +/- 10% => from 6.82 KHZ to 8.25 Khz
' measuring the frequency period =>147uSec to 121uSec
'
FI VAR PORTA.3 'input freq
SO VAR PORTB.0 'OUPUT LED
W0 VAR byte
TLow var byte
THigh var byte
INIT:
pulsin fi,0,Tlow
pulsin fi,1,Thigh
w0=tlow+thigh
IF (W0<15) AND (w0>12) then PULSE
GOTO INIT
PULSE:
HIGH SO
PAUSE 500
LOW SO
PAUSE 500
GOTO INIT
END
make sense to me ... after being more than 24 hours awake...
Bookmarks