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.
I try to make a second counter with an Eico 40th It uses a 48 mhz crystal. I want it as accurate as possible. I naturally use an interrupt, but when I eksambel use, shares 1:256 I get, 183.105 and it does not give an exact division. I know it's possible to use an offset in C Code, is there anyone in this forum who can tell me how it should be by the various divisions of the interrupt or how to calculate this,
1:1= ?
1:2= ?
1:4= ?
1:8= ?
ect,ect.and without to use the 1 sec delay.
It is not recommended to place component macros which would contain delays them self within an interrupt. or in your case a call macro to update LCD display
If you do not remove the call macro, there would probably be stack corruption issues.
Best way is to set a variable called update for instance = 1 (instead of calling LCD update macro) after a second has elapsed. Then in main.
If update = 1 then update LCD : update = 0
Hope this makes sense.
for TIMER0, the frequency of the interrupt is (see datasheet of your favorite Pic, chapter Timer0)
For a basic use of Flowcode
f (INT) = f(Quartz) / 4 / (prediv) / 256
If you use C code :
(INT) = f(Quartz) / 4 / (prediv) / X,
you must add at the beginning of the interrupt macro a C icon with " tmr0l = Y ; " with Y = 256 - X .
(note : tmr0l = TMR0L in lower case)
If you are lucky, you can find a whole number N ( N < 255) that gives a whole value for f(INT)
for example N = 125 ; give for ECIO f(int) = 375 Hz.
Add " tmr0l = 131 ; " because 131 = 256 - 125. (without the quotation marks" and don't forget the semi colon at the end).
Your variable "count" must be an integer. (375 > 255)
I hope my explanations are enough clear
If 375 Hz is too quick , you can use TIMER1 (or 2)
Hi both!
Thanks for your reply. I have tried following the instructions, but without success. The problem is that I do not have much experience with processors and their architecture. but trying to learn it.
Right now, I need 1sec, exactly by means of interrupt. I roughly understand how it works, basic. If I use crystal 19660800 mhz. it fits just fine with sharing an integer.
Would one of you be so kind and tell me how Ccode offset timer should be if I Eico uses a 48 mhz crystal and by the different sharing options in Interrupt for Timer0
1:01 = Ccode offset?
1:02 = "?
1:04 = "?
1:08 = "?
1:16 = "?
1:32 = "?
1:64 = "?
1:128 = "?
Or what am I doing in the past eksembel which I've attached to a precise second.
It is a misconception Dan. Your Flow Code works perfectly. I have probably expressed myself incorrectly. But it's me who does not really found out the calculations. But after your explanation I begin to see the light.
Sorry.
And thanks for your new proposal. Them I will also study very carefully
By the way, did you get my mail that I sent to you privately?