Page 1 of 1

Interrupt with Timer Question.

Posted: Tue Jun 22, 2021 3:23 pm
by seokgi
Good morning?
I want to measure RPM using timer.
As in the attached program, when an interrupt occurs, a timer is operated to calculate RPM with the count value.

However, the timer does not work when using interrupts.

This is done in a normal routine.

Is there something I'm missing out on?

Please advise.

MCU: PIC18F47Q10
Clock: Internal 64MHz

Re: Interrupt with Timer Question.

Posted: Tue Jun 22, 2021 6:39 pm
by mnfisher
Hi seokgi,

You are trying to do too much in the interrupt handler (for example send data to UART) - this will probably cause things to break...

The interrupt should just increment a counter (to count pulses on pin 0 for example)...

Martin

Re: Interrupt with Timer Question.

Posted: Tue Jun 22, 2021 11:48 pm
by seokgi
Thanks for the advice
However, the interrupt is occurring at 1 Hz.
I don't think UART has any effect.
StartTimer() does not work.

As you advised, I'll modify the program and test it.

Re: Interrupt with Timer Question.

Posted: Wed Jun 23, 2021 12:48 am
by mnfisher
Hi,

Transmitting via uart requires some timing - and may well involve other interrupts. Keep the interrupt service routine as short as possible (this is true when using any language - not just for flowcode) - you'll save a lot of difficulty and debugging time too

Martin