2005-04-13 08:44 PM
2004-08-17 03:15 AM
I'm using the ST7LITE05, with internal 1 MHz oscillator and X8 PLL.
The AT Timer interrupts the main program at a 25 KHZ frquency. It makes it twice Output Compare (OC) and Overflow (OF) The LITE Timer is set to interrupt at 1 ms. Because the AT Timer has higher priority then the LITE Timer it seem some LITE timer interrupts are not handled. How can I handle all the interrupts of both timer? Thanks ............ Claudio2004-08-19 08:05 PM
ART Timer Interrupt has priority over Lite Timer Interrupt and if they both occur simultaneously then first ART Timer Interrupts (Output compare and Overflow) will be service and then only Lite Timer Interrupt will be service. None of your Interrupts will be missed, once a flag is set an Interrupt will occur until the flag is cleared. But incase you are missing the Lite Timer Interrupt that means you are clearing the flag associated outside your ISR and hence you are missing the Interrupt. Please check your code that you are not clearing some flag unintentionally.
2005-04-13 02:54 AM
Hi all,
I think that I have a similar problem in my application with ST7FLITE05M. My program only use the Lite Timer Timebase interrupt and some interrupts seems to be missed and not appear. I check my code and no flag are cleared unintentionally. The only operation I make on the LTCSR register is to regulary set the WDGD bit in order to prevent watchdog reset and read the LTCSR register in interrupt subroutine in order to clear the TBF flag. So, some interrupt seems to not appear but I don't know why....2005-04-13 03:12 AM
Akotronic, how do you set the WDGD bit?
Please, be informed that you can not use a BSET instruction because it reads first LTCSR, sets the bit and writes the result back to LTCSR. This behaviour may clear the TBF flag... Regards, EtaPhi2005-04-13 03:16 AM
Thank you very much for your answer. In fact, I set the WDGD bit with:
bset LTCSR,#WDGD So, what kind of instruction can I use to set this bit without reading the LTCSR register ? Thanks in advance.2005-04-13 03:38 AM
If your timebase is 1 ms, here are the instructions:
LD A,#%00010011 LD LTCSR,A If you selected the 2ms timebase, you have to change the constant to: %00110011 In a few words, you have to initialize the LTCSR with the right value. EtaPhi2005-04-13 05:09 AM
EtaPhi,
Thank you very much for your help. The solution I found is to set the WDGD bit during the interrupt subroutine because the period between 2 interrupt is smaller than watchdog timeout period. So with the same instruction (bset) I can reload the watchdog and clear the interrupt flag. All is OK now and running well. Thank you very much for your help. Yann2005-04-13 07:59 PM
Akotronic,
your solution works, but I would not use it since the watchdog function will be voided. Now your application every ms refreshes the watchdog. Your interrupt routine is perfect and it will be ''fired'' periodically. If somewhere else there is a problem (e.g. an infinite loop), this situation will not be detected... Regards, EtaPhi2005-04-13 08:44 PM
EtaPhi,
You're right. This method has no interest to use the watchdog because infinite loop will not cause a reset. In the ST7LITE0/ST7SUPERLITE datasheet, it's said that the timebase feature can be used to set the WDGD bit at regular interval...that's strange. So, I will use your method that is more effective. Thanks for your help. Yann [ This message was edited by: Akotronic on 14-04-2005 09:15 ]