Interrupt seems to be affecting the Primary Clock

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 29 times
Been thanked: 30 times
Contact:

Interrupt seems to be affecting the Primary Clock

Post by Lord Grezington »

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
freq test.fcfx
(9.24 KiB) Downloaded 152 times

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 29 times
Been thanked: 30 times
Contact:

Re: Interrupt seems to be affecting the Primary Clock

Post by Lord Grezington »

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?

User avatar
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

Post by Benj »

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.

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 29 times
Been thanked: 30 times
Contact:

Re: Interrupt seems to be affecting the Primary Clock

Post by Lord Grezington »

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

Post Reply