Page 1 of 1
PIC24FV32KA304 Interrupt frequency calculation
Posted: Sat Jul 06, 2024 9:01 am
by Jorg_Guldner
Hi,
is it possible to show the interrupt frequency ?
regards
Jorg
Re: PIC24FV32KA304 Interrupt frequency calculation
Posted: Sat Jul 06, 2024 10:16 am
by Steve-Matrix
You have specified an external source for the clock. So Flowcode does not know what the actual speed of the clock will be and so cannot calculate the interrupt frequency. The "Clock Speed" value near the bottom of the page is the speed of the internal clock.
Re: PIC24FV32KA304 Interrupt frequency calculation
Posted: Sun Jul 07, 2024 5:10 pm
by Jorg_Guldner
Hi,
you know, that the clock is set to external by setup. The value which is normally used for internal calculation gets the quartz frequency. You always know too, if the "pll" is selected or not. All values for calculation are inside the program. Is it not possible?
Regards
Jorg
Re: PIC24FV32KA304 Interrupt frequency calculation
Posted: Mon Jul 08, 2024 10:18 am
by BenR
Hi Jorg,
Steve is correct with the timer set to External mode it is expecting pulses on the T1CK pin to be used to clock the timer. As Flowcode doen't know what's external to this pin it cannot work out the timings for you.

- Pins.jpg (98.25 KiB) Viewed 5193 times
Setting the clock source to one of the internal clocks will allow Flowcode to then know and sync the timings up with the MCU clock source and do the calculation.
Re: PIC24FV32KA304 Interrupt frequency calculation
Posted: Mon Jul 08, 2024 10:56 am
by Steve-Matrix
Looking at this in more detail, the datasheet says T1CON:TCS selects the source input and can be either "Internal (Fosc/2)" or "Timer1 clock source selected by T1ECS<1:0>". The latter has the following options:
- 11 = Reserved; do not use
- 10 = Timer1 uses LPRC as the clock source (fixed 31 kHz)
- 01 = Timer1 uses External Clock from T1CK (see Ben's post)
- 00 = Timer1 uses Secondary Oscillator (SOSC) as the clock source
Flowcode assumes when using the latter you will be using T1CK and so it is shortened to "External" in the option list.
When you dig into the SOSC clock source, things get complicated further.
As you can see, clocks and interrupt sources can be complex, and Flowcode does not always offer every solution in a neat way - especially when you consider the range of devices it supports. You can use your own C code to change the clock source in this register if you like. But then Flowcode cannot know the actual source of the clock.
As a convenience, the Interrupt Properties window calculates the actual interrupt frequency in the less complex cases. If you have clock settings that are more complex, then you will need to manually calculate the actual interrupt frequency and/or create some kind of "LED flasher" program that allows you to measure it for your settings.
Re: PIC24FV32KA304 Interrupt frequency calculation
Posted: Tue Jul 09, 2024 6:48 am
by Jorg_Guldner
Hi,
I know that you could do many setups. It was a discussion to find a way for a workaround not to use an oscilloscope.
A complete setup of the oscillator and timer section would be good, but this would take a lot of time.
Excuse me for posting this thread in the bug area.
Jorg
Re: PIC24FV32KA304 Interrupt frequency calculation
Posted: Tue Jul 09, 2024 7:06 am
by medelec35
As Flowcode was designed to not show external interrupt frequencies, I have move this to the General section.