Problem with Timer

Post Reply
B2CAP-V6
Posts: 11
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 2:15 pm
Been thanked: 5 times

Problem with Timer

Post by B2CAP-V6 »

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
Attachments
Automat_Abri_18F.fcfx
(67.5 KiB) Downloaded 15 times

medelec35
Matrix Staff
Posts: 692
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 242 times
Been thanked: 244 times

Re: Problem with Timer

Post by medelec35 »

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.
Attachments
Automat_Abri_18F v2.fcfx
(61.73 KiB) Downloaded 13 times
Martin

B2CAP-V6
Posts: 11
Joined: Fri Dec 04, 2020 2:15 pm
Been thanked: 5 times

Re: Problem with Timer

Post by B2CAP-V6 »

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

medelec35
Matrix Staff
Posts: 692
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 242 times
Been thanked: 244 times

Re: Problem with Timer

Post by medelec35 »

Have you tried a new test flowchart, using timer 3 to toggle an output?
Then you will know if it is your program or the timer 3 interrupt itself.
Martin

B2CAP-V6
Posts: 11
Joined: Fri Dec 04, 2020 2:15 pm
Been thanked: 5 times

Re: Problem with Timer

Post by B2CAP-V6 »

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
Attachments
Timer3.png
Timer3.png (63.31 KiB) Viewed 251 times

Post Reply