Hello All,
In the attached flowchart, timer 3 seems to be activated but the "Tempo" macro does not seem to be called.
It's very strange because in Flowcode simulation the counter "Compt_Tempo" increments but in real or in simulation with Proteus it does not increment.
I think I'm missing an error but I don't see where.
Do you have an idea?
Many thanks in advance
Best Regards
Luc
Problem with Timer
-
- Posts: 11
- http://meble-kuchenne.info.pl
- Joined: Fri Dec 04, 2020 2:15 pm
- Been thanked: 5 times
-
- Matrix Staff
- Posts: 1922
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 623 times
- Been thanked: 645 times
Re: Problem with Timer
Hello.
Can you see if the attached flowchart works any better?
Your flowchart had a component macro within the interrupt.
If the same component is anywhere else then the hardware will become corrupt.
Also, I have found in the past, that there is an issue if you disable an interrupt within an interrupt.
Can you see if the attached flowchart works any better?
Your flowchart had a component macro within the interrupt.
If the same component is anywhere else then the hardware will become corrupt.
Also, I have found in the past, that there is an issue if you disable an interrupt within an interrupt.
- Attachments
-
- Automat_Abri_18F v2.fcfx
- (61.73 KiB) Downloaded 124 times
Martin
Re: Problem with Timer
Hello Martin and thank you for your help.
Your flowchart is not working.
In fact the TMR1 "chain" works correctly, it is only the TMR3 "chain" that does not work.
In principle, TMR1 is used to turn off the backlight LED of the display after a certain time if there is no manual action on the push buttons.
TMR3 is used to activate "Fermeture Porte (Door closing)" after a certain time, when there has been a "Ouverture Porte (Door opening)" action in the "Cde_Porte_Auto" macro.
In detail: When one of the 2 sensors (DEXT, DINT) or both or "ValPoids=1" the "Ouverture Porte (Door opening)" action is validated, it is stopped when "FCO" is activated (FCO=0), and there "Var_Ferm" changes to 1 in the macro "Cde_Porte_ Auto"
Then in the "Main" macro when "DEXT, DINT, Var_Ferm" are at 1 and "ValPoids and FCO" are at 0, the TMR3 interrupt is activated in order to be able to activate "Fermeture Porte (Door Closing)" after a certain time, time which is given by the "Tempo" macro and this is where there is the problem because the "Compt_Tempo" counter always remains at 0.
I hope I was clear in my explanations.
Luc
Your flowchart is not working.
In fact the TMR1 "chain" works correctly, it is only the TMR3 "chain" that does not work.
In principle, TMR1 is used to turn off the backlight LED of the display after a certain time if there is no manual action on the push buttons.
TMR3 is used to activate "Fermeture Porte (Door closing)" after a certain time, when there has been a "Ouverture Porte (Door opening)" action in the "Cde_Porte_Auto" macro.
In detail: When one of the 2 sensors (DEXT, DINT) or both or "ValPoids=1" the "Ouverture Porte (Door opening)" action is validated, it is stopped when "FCO" is activated (FCO=0), and there "Var_Ferm" changes to 1 in the macro "Cde_Porte_ Auto"
Then in the "Main" macro when "DEXT, DINT, Var_Ferm" are at 1 and "ValPoids and FCO" are at 0, the TMR3 interrupt is activated in order to be able to activate "Fermeture Porte (Door Closing)" after a certain time, time which is given by the "Tempo" macro and this is where there is the problem because the "Compt_Tempo" counter always remains at 0.
I hope I was clear in my explanations.
Luc
Re: Problem with Timer
Hi Martin,
I just modified the timer configuration (see circled in red) and it works.
"Timer 3 register read/write in one 16 bit" to "Timer 3 register read/write in two 8 bit"
A great thank
Luc
I just modified the timer configuration (see circled in red) and it works.
"Timer 3 register read/write in one 16 bit" to "Timer 3 register read/write in two 8 bit"
A great thank
Luc
- Attachments
-
- Timer3.png (63.31 KiB) Viewed 1938 times