Help with interruption

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

Moderator: Benj

Post Reply
RLOPES780
Posts: 119
Joined: Tue Apr 07, 2015 11:01 am
Been thanked: 3 times

Help with interruption

Post by RLOPES780 »

Hello friends;

I'm using pic 18f2423 and need to generate a 1hz interrupt to call a macro.
Looking at the properties of timer interrupts 0,1,2,3 I can not create a interruption of 1 hz.
I have the code attached, someone could help me how can I configure this interruption

Grateful;

Ricardo.
Attachments
SR CARLOS.fcfx
(9.83 KiB) Downloaded 234 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Help with interruption

Post by medelec35 »

Hi Ricardo,
Attached Flowchart (Untested) should clear MAXIMO every second.
I have set interrupt for 200Hz.
Therefore if interrupt macro is accessed 200 times then one second has elapsed.

Martin
Attachments
SR CARLOS V2.fcfx
(11.13 KiB) Downloaded 229 times
Martin

RLOPES780
Posts: 119
Joined: Tue Apr 07, 2015 11:01 am
Been thanked: 3 times

Re: Help with interruption

Post by RLOPES780 »

Hello Martin;

Thank you for your attention and willingness to help.
Looks like it worked !!!!!
What I really need is to reset the maximum variable every 1 second.
And that's what you did?
I just do not understand The clock is 32 MHz and the interrupt frequency is 200 Hz. How does the interruption occur every 1 second? Can you explain me?

Grateful;

Ricardo

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: Help with interruption

Post by medelec35 »

Hi Ricardo,
Glad It works.
RLOPES780 wrote:I just do not understand The clock is 32 MHz and the interrupt frequency is 200 Hz. How does the interruption occur every 1 second? Can you explain me?
As stated on the above post
medelec35 wrote:I have set interrupt for 200Hz.
Therefore if interrupt macro is accessed 200 times then one second has elapsed.
The interrupt is not triggered every second as that is not possible at 32MHz
So the interrupt is triggered 200 times every second.
If a count variable called INTCount for example is incremented every time interrupt is accessed, then when

Code: Select all

INTCount = 200
then 1 second has elapsed.
You can use a decision branch

Code: Select all

If:INTCount = 200
:

Code: Select all

 INTCount = 0
,

Code: Select all

MAXIMO = 0
RLOPES780 wrote:What I really need is to reset the maximum variable every 1 second.
And that's what you did?
Every second

Code: Select all

MAXIMO = 0
So if that's the intention then yes.

Martin
Martin

Post Reply