Hello All
I have a simple program, I am trying to use a timer interrupt (Tried all 1, 2, 3 & 5) at a high frequency as a fairly accurate timer. But whenever I change the frequency it seems to affect the primary clock on the crystal (even though the clock source for hte interrupt is set to the Internal ocsillator). I nthe program attached, if I set the Rolleover to 60, I get the pulse output @ around 15ms (when the delay is set to 1ms). If I set the Rollover to 600 I not get the 1ms delay.
I was hoping for a reliable timer interrupt of at least 1Mhz, anyone know how they can help?
Thanks
Interrupt seems to be affecting the Primary Clock
Moderator: Benj
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: Interrupt seems to be affecting the Primary Clock
Hi guys
Any help on this?
I have just tried setting up an external clock input into INT1, however it seems I cant get passed around 10Khz interrupt.
My target at this point is to perform a few calculations every 60Khz fairly accuratly...
Thanks
EDIT: Just another note - I did a program on hardware that just flashed an output high/low with no delays in a loop and I measured a frequency of just under 30Khz. Surely something is wrong as the clock speed is running 120Mhz?
Any help on this?
I have just tried setting up an external clock input into INT1, however it seems I cant get passed around 10Khz interrupt.
My target at this point is to perform a few calculations every 60Khz fairly accuratly...
Thanks
EDIT: Just another note - I did a program on hardware that just flashed an output high/low with no delays in a loop and I measured a frequency of just under 30Khz. Surely something is wrong as the clock speed is running 120Mhz?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Interrupt seems to be affecting the Primary Clock
Hello,
First I would check your clock speed setting is ok by using something like this without an interrupt.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher
I see you have custom C code to set the clock so maybe this is having an incorrect effect?
If the interrupt is firing too quickly then there is a chance your code in main will never get to run as the interrupt is ready to go again by the time it leaves the macro. Removing the auto psv might help to reduce latency so we can look into helping you do this if needed.
First I would check your clock speed setting is ok by using something like this without an interrupt.
https://www.matrixtsl.com/wiki/index.ph ... ED_flasher
I see you have custom C code to set the clock so maybe this is having an incorrect effect?
If the interrupt is firing too quickly then there is a chance your code in main will never get to run as the interrupt is ready to go again by the time it leaves the macro. Removing the auto psv might help to reduce latency so we can look into helping you do this if needed.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
Re: Interrupt seems to be affecting the Primary Clock
Hi Ben
The program in the first post was just a standard flasher program, and the timing is perfect. The C-code is needed to set the frequency up to 120Mhz.
I have also disabled the interupt, and then repeated the flasher with no delays and observed a frequency (of the flash) of only just 30Khz.
Thanks
The program in the first post was just a standard flasher program, and the timing is perfect. The C-code is needed to set the frequency up to 120Mhz.
I have also disabled the interupt, and then repeated the flasher with no delays and observed a frequency (of the flash) of only just 30Khz.
Thanks