Trouble with CTRA
realolman
Posts: 65
I would like to use the CTRA , but I am having trouble.
I have a switch with a 12k pull down resistor hooked to P10.
At this point I am not concerned with much of anything, except I think I should see some activity on pins 17-21 and I see nothing... what am I doing wrong.
I would like to be able to determine if the thing is in fact counting.· I preset phsa to 3 just to see it on pins 17- 21 and it is there, but no counting
Post Edited (realolman) : 1/26/2009 9:48:25 PM GMT
PUB CountInput Dira[noparse][[/noparse]11..21]~~ Dira[noparse][[/noparse]10]~ 'set counter to positive edge detector CTRA := %01010 << 26 ctra := ctra + 10 'sets counter to use pin 10 'read accumulator value and place on pins phsa :=3 repeat Outa[noparse][[/noparse]17..21]:=phsa
I have a switch with a 12k pull down resistor hooked to P10.
At this point I am not concerned with much of anything, except I think I should see some activity on pins 17-21 and I see nothing... what am I doing wrong.
I would like to be able to determine if the thing is in fact counting.· I preset phsa to 3 just to see it on pins 17- 21 and it is there, but no counting
Post Edited (realolman) : 1/26/2009 9:48:25 PM GMT
Comments
-Phil
The reason for this is it's insensitive to whether you set frqa before or after setting ctra. If you set frqa before setting ctra, by setting pina after setting the mode, you have actually started the counter using pin 0 until the next instruction is executed so you may get an erronious count depending on whats happening on pin 0.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker