Page 1 of 1
Help with interruption
Posted: Tue May 09, 2017 6:36 am
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.
Re: Help with interruption
Posted: Tue May 09, 2017 9:04 am
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
Re: Help with interruption
Posted: Tue May 09, 2017 1:09 pm
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
Re: Help with interruption
Posted: Tue May 09, 2017 2:10 pm
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
then 1 second has elapsed.
You can use a decision branch
:
,
RLOPES780 wrote:What I really need is to reset the maximum variable every 1 second.
And that's what you did?
Every second
So if that's the intention then yes.
Martin