Above code is launched, when signal on input pin arrives, I just missed that line here.
I discarded the COUNT statement, and wrote software substitute, which accurately counts amount of pulses:
Code:
UIDEDA:
if pulsi=1 then
FOR N=0 TO 300 'this is length of capture period, 300 for 16F870 @ 4mhz means approx 15ms.
IF PULSI=1 THEN
A=A+c
c=0
d=1
ELSE
B=B+d
d=0
c=1
ENDIF
NEXT
IF A<>0 AND B<>0 THEN
lcdout $FE,2, "A=",#A, " "
lcdout $FE,$C0,"B=",#B, " "
ENDIF
A=0
B=0
endif
GOTO UIDEDA
I'm interested, why count never works as it should.
Bookmarks