INT TMR0 or simulation problem

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
ITISVARESE
Posts: 56
Joined: Sat Jul 07, 2007 3:00 pm
Has thanked: 9 times
Been thanked: 3 times
Contact:

INT TMR0 or simulation problem

Post by ITISVARESE »

This simple flowchart must toogle led on or off for 1 second; when i simule it in flowccide V4
time of lightining is missing.
Code in real world work ok.
Attachments
Prova1.fcf
(6.5 KiB) Downloaded 352 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: INT TMR0 or simulation problem

Post by medelec35 »

I agree the simulation for TMR0 has a bug and is not working, and your program is working.

One general point on interrupts and accuracy.
If accuracy is important, then you need to select a prescaler rate that is as close to a whole number as you can get.
Then set the decision for greater than 1 number less than this whole number.
E.g. Assuming 4MHz internal Osc is accurate.
With your settings of prescaler rate = 1:128. The interrupt will call your INT_TMRO macro 30.5 times every second since that is the interrupt frequency. Since a macro cannot be called for a number fraction times i.e. you can call macro once, but you can't call a macro more than 0 and less than once (e.g 1/2), so there will be small errors if interrupt frequency is not a whole number.
Since the Entrate Decision is set for 33, then the yes branch will followed every 1.081 seconds. (if you set Entrate for >30 or set to =31 then yes branch will followed every 1.016 seconds)

If you change prescaler rate to 1:64. The interrupt will call your INT_TMRO macro 61.035 times every second
change Entrate Decision to >60 then yes branch will followed every 0.999 seconds.
Martin

ITISVARESE
Posts: 56
Joined: Sat Jul 07, 2007 3:00 pm
Has thanked: 9 times
Been thanked: 3 times
Contact:

Re: INT TMR0 or simulation problem

Post by ITISVARESE »

Thank for Your reply,
i agree and know what You says but it is only a sample to test simulation interrupt in V4
and not a really work; i want a confirm that problem is in V4.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: INT TMR0 or simulation problem

Post by medelec35 »

Your welcome. Yes problem is in V4 simulation only as stated in previous post
The information I posted is aimed at any one who is using timer interrupt for the first time, or not 100% sure how it works.
I was not sure if you did or not.
Martin

Post Reply