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
Interrupt with Timer Question.
-
- Posts: 206
- 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.
- Attachments
-
- Auto_Lifting_Lamp_Control_1_RPM.fcfx
- (18.89 KiB) Downloaded 476 times
-
- Valued Contributor
- Posts: 1454
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 708 times
Re: Interrupt with Timer Question.
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
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.
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.
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.
-
- Valued Contributor
- Posts: 1454
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 135 times
- Been thanked: 708 times
Re: Interrupt with Timer Question.
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
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