Interrupt with Timer Question.

For general Flowcode discussion that does not belong in the other sections.
Post Reply
seokgi
Posts: 182
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Interrupt with Timer Question.

Post 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
Attachments
Auto_Lifting_Lamp_Control_1_RPM.fcfx
(18.89 KiB) Downloaded 176 times

mnfisher
Valued Contributor
Posts: 1056
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 107 times
Been thanked: 546 times

Re: Interrupt with Timer Question.

Post 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

seokgi
Posts: 182
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 5 times
Been thanked: 7 times

Re: Interrupt with Timer Question.

Post 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.

mnfisher
Valued Contributor
Posts: 1056
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 107 times
Been thanked: 546 times

Re: Interrupt with Timer Question.

Post 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

Post Reply