Hello, I join a flowcode chart.
This is a "clock", The Pic 16F877 drives five "7 segments displays" with internal decoder BCD.
So I use 4 bits for the units second display, 4 bits for the 10 seconds displays, 4 bits for the unit minute display and so on.
I also use 2 bits for the change; I explain, at the start ( pushbutton by the user) the clock counts down and one bit is on, it displaysfirst cycle, when the count is empty, the system restarts automatically without the user, and an the bit is off, but an other bit is on ( second cycle tide) , third cycle, first bit, fourth cycle second bit.................
The system must be driven by 1 Hz pulse, I try to drive the clock with the internal clock of the pic with the timer 0, but I do not understand well the interrupt, and my system does not run at 1 Hz.
Can you explain my mistake?
regards.
helesmes.
Interrupt
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Interrupt
Hello,
In your TMR0_1_Seconde macro you are correctly counting 75 interrupts to calculate 1 second.
What you are not doing is incrementing/decrementing the second count, you should probably do this directly under the macro labelled "Incrementer Interrupt compteur" on the Yes branch of the decision icon.
In your TMR0_1_Seconde macro you are correctly counting 75 interrupts to calculate 1 second.
What you are not doing is incrementing/decrementing the second count, you should probably do this directly under the macro labelled "Incrementer Interrupt compteur" on the Yes branch of the decision icon.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 594
- Joined: Thu Sep 17, 2009 7:52 am
- Location: Belgium
- Has thanked: 63 times
- Been thanked: 102 times
- Contact:
Re: Interrupt
I moved this topic to Flowcode v4 as it was in the French section of the forum and you seem to be a Flowcode v4 user.
Hope you don't mind .
Nicolas
Hope you don't mind .
Nicolas
-
- Flowcode v5 User
- Posts: 15
- Joined: Thu Dec 01, 2011 6:33 pm
- Location: France / Nord
- Has thanked: 3 times
- Contact:
Re: Interrupt
***********************Benj wrote:Hello,
In your TMR0_1_Seconde macro you are correctly counting 75 interrupts to calculate 1 second.
What you are not doing is incrementing/decrementing the second count, you should probably do this directly under the macro labelled "Incrementer Interrupt compteur" on the Yes branch of the decision icon.
Hello Ben, thank you for your prompt answer.
I insert the "decrementing fonction" in the yes branch of the decision, but I am sorry, the clock does not count correctly, the frequency without measurement is +/- 20 Hz.
I join you the "new" flowcode
Regards helesmes.
- Attachments
-
- SYNTHESE_MAREE 877_INTERRUPT_N2_OK.fcf
- (42.53 KiB) Downloaded 408 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Interrupt
Hello,
I see the problem now. In the TMR0_1_seconde macro move the code out of the while 1 loop and then delete the while icon. The interrupt will not work correctly if you try and stay in the macro while the int_count is counting from 0 to 75.
I see the problem now. In the TMR0_1_seconde macro move the code out of the while 1 loop and then delete the while icon. The interrupt will not work correctly if you try and stay in the macro while the int_count is counting from 0 to 75.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 15
- Joined: Thu Dec 01, 2011 6:33 pm
- Location: France / Nord
- Has thanked: 3 times
- Contact:
Re: Interrupt
Benj,
thank you very much for your help.
My system is ok, I am going to observe it during several days to see how many seconds it loses or it wins.
Helesmes.
thank you very much for your help.
My system is ok, I am going to observe it during several days to see how many seconds it loses or it wins.
Helesmes.