Hairy Animal
Member
I have a circuit which generates 600µs negative pulses which I want to count with interrupts (incrementing dcl_in), because I don't want to miss any pulses while other things might be happening.
Being unfamiliar with PicAxe interrupts I followed the example in the manual and generated this:
This consistently returns
So the question is, what's wrong with
which I added to give me a rough idea of how many machine cycles the processor goes through while waiting for the interrupt condition to go away?
The variable "int_timer" is a word variable by the way, in case it ends up as a big number. It's running on an 08M2+ for the record.
Thanks.
Being unfamiliar with PicAxe interrupts I followed the example in the manual and generated this:
Code:
interrupt:
SETFREQ m16
LET int_timer = int_timer + 1
IF pinC.3 = 0 THEN interrupt
SETFREQ m4
LET dcl_in = dcl_in + 1
SERTXD ("Interrupt length ",#int_timer," cycles",LF,CR)
int_timer = 0
; more stuff
SETINT %00000000 , %00001000
RETURN
which it did before I added the "SETFREQ m16" and also did when I only had a 200µs interrupt pulse, which I thought might not be long enough, but probably was.Interrupt length 1 cycles
So the question is, what's wrong with
Code:
LET int_timer = int_timer + 1
The variable "int_timer" is a word variable by the way, in case it ends up as a big number. It's running on an 08M2+ for the record.
Thanks.