2004-09-19 09:59 PM
2004-09-13 01:28 AM
Previously instead of using the output compare mode of the autoreload timer I have used the overflow flag eg.
generate 2000Hz interrupt. ATR = 0x10; ATCSR = 0b00010010; this seems to work fine if using the fcpu as the timebase, if I change to using the fltimer as the timebase the interrupt is unpredictable. I wanted to use the overflow flag as a 1Hz interrupt, eg. ATR = 0xC18; ATCSR = 0b00001010; I have solved the problem by switching back to output compare mode, is this not possible using the overflow flag? Regards sjo[ This message was edited by: sjo on 13-09-2004 17:38 ]2004-09-13 04:53 AM
If you select your clock source as Lite Timer then your ART will be clocked by the Lite timer i.e 1msec @ 8MHz Fcpu. The 12-bit upcounter will increment every 1msec, now if you want an overflow flag at 1Hz then set the ATR value accordingly.
2004-09-13 05:55 AM
Is 0xC18 not the correct ATR value for a 1Hz (@8MHz fcpu) interrupt then?
ATR = 0xC18; ATCSR = 0b00001010; Any help would be greatly appreciated. Regards sjo2004-09-14 09:02 PM
I dont think that you forget to clear the OVF flag or to save the used registers in your interrupt routine.
But there is another trap: If you read the ATCSR e.g. to check the ICF flag(Lite1X and Lite2X) the OVF will be cleared by the way. Otherwise it would be helpfull to know a little more about your effect. Regards WoRO2004-09-15 12:19 AM
Its not really problem as I can just use output compare mode.
Its just if I am using the overflow interrupt as a timebase when using fcpu as the timer clock everything behaves, as soon as I switch to using fltimer as timer clock the timings are incorrect. eg. 2KHz interrupt (fcpu timebase) using output compare mode DCR0 = 0xFA0 using overflow ATR = 0x60 the above work ok, if I change the timer clock source to fltimer, eg. 1Hz interrupt (fltimer timebase) DCR0 = 0x3E8 using overflow ATR = 0xC18 the output compare mode works ok but the results for overflow are very unpredictable. I have noticed that on the flite2x datasheet it states that pwm and output compare mode should not be used with fltimer as the clock source, is this valid for flite0x aswell? Regards sjo2004-09-17 04:08 AM
With the configuration as you have suggested
ATR = 0xC18; ATCSR = 00001010; You should get the overflow Interrupt at 1Hz frequency. Regarding the note you have mentioned that is only specific to Lite2. There is no such restriction for Lite0, you can use the PWM mode and the Output compare modes at FLTimer frequency2004-09-19 09:59 PM
I agree you should get the overflow @ 1Hz, but if you try it in silicon the results are very strange. As I had said before the results are as expected when using fcpu as the timebase.
Regards sjo