Impluse counter
Renesis
Posts: 4
Hello!
I would like to count impluse on port 14 (about 1 KHz), not measure frequency.
I wrote this PUB:
if ina[14]
sz1:=1
if sz2==0
x=x+1
sz2:=1
if not ina[14]
sz1:=0
sz2:=0
X variable is the counter. This is working, but too slow.
I tried with the registers (CTR.FRQ and PHS), but that was too fast
When the Propeller got az impulse, that mode counted 2 or 3 times.
CTRA:=%0_01010_000_0000_0000_000000_000_001110
FRQA:=1
PHSA:=0
I prefer the first, but i can not speed it up.
Do you have any idea?
Thank for your help.
I would like to count impluse on port 14 (about 1 KHz), not measure frequency.
I wrote this PUB:
if ina[14]
sz1:=1
if sz2==0
x=x+1
sz2:=1
if not ina[14]
sz1:=0
sz2:=0
X variable is the counter. This is working, but too slow.
I tried with the registers (CTR.FRQ and PHS), but that was too fast
When the Propeller got az impulse, that mode counted 2 or 3 times.
CTRA:=%0_01010_000_0000_0000_000000_000_001110
FRQA:=1
PHSA:=0
I prefer the first, but i can not speed it up.
Do you have any idea?
Thank for your help.
Comments
-Phil