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.
Help with interruption
Moderator: Benj
-
- 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
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
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
Re: Help with interruption
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
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
-
- 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
Hi Ricardo,
Glad It works.
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 : ,
So if that's the intention then yes.
Martin
Glad It works.
As stated on the above postRLOPES780 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?
The interrupt is not triggered every second as that is not possible at 32MHzmedelec35 wrote:I have set interrupt for 200Hz.
Therefore if interrupt macro is accessed 200 times then one second has elapsed.
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
You can use a decision branch
Code: Select all
If:INTCount = 200
Code: Select all
INTCount = 0
Code: Select all
MAXIMO = 0
Every secondRLOPES780 wrote:What I really need is to reset the maximum variable every 1 second.
And that's what you did?
Code: Select all
MAXIMO = 0
Martin
Martin