Interrupt

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
helesmes
Flowcode v5 User
Posts: 15
Joined: Thu Dec 01, 2011 6:33 pm
Location: France / Nord
Has thanked: 3 times
Contact:

Interrupt

Post by helesmes »

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.
Attachments
SYNTHESE_MAREE 877_INTERRUPT_N2_OK.fcf
(42.53 KiB) Downloaded 398 times

User avatar
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

Post by Benj »

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.

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: Interrupt

Post by Spanish_dude »

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

helesmes
Flowcode v5 User
Posts: 15
Joined: Thu Dec 01, 2011 6:33 pm
Location: France / Nord
Has thanked: 3 times
Contact:

Re: Interrupt

Post by helesmes »

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

User avatar
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

Post by Benj »

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.

helesmes
Flowcode v5 User
Posts: 15
Joined: Thu Dec 01, 2011 6:33 pm
Location: France / Nord
Has thanked: 3 times
Contact:

Re: Interrupt

Post by helesmes »

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.

Post Reply