Is it Possible to use Timer/Counter2 of ATmega32 in femtoOS 0.92?
If possible, then how to use it and it's overflow vectors and other options?
If not, then why?
How femtoOS 0.92's OS tick Works? Which resources of microcontroller it use?
Dose femtoOS 0.92 use any timer for it's "OS ticks"?
N.B: (Though, I don't have much knowledge about OS, Question might be seems so STUPID....... sorry for that ... :-/ )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The shorter the question, the longer the answer. "How femtoOS 0.92's OS tick Works?", i can write several pages on that, for which i do certainly not have the time. In general, it works like any RTOS. There is a timer that generates an interrupt, and a context switch takes place to switch to a new task. However, in Femto OS much more is going on, since, to save memory, the OS, does not run on the task stack but has its own, and thus also a stack change is performed. In order to keep the overhead low it also determines if other tasks are due soon etc etc.
Depending on the chip the tick timer uses timer 0 or timer 2. This can be found in the devices file. For the ATmega32 that is /MainCode/femtoos_devices/femtoos_ATmega32A.asm under / Timer settings / you see what is used. This particular chip uses timer0, so 2 is free for own use, but you could, in principe, if you really need timer0 yourself for other purposes switch to timer2 for the tick. This may lead to unexpected behavior though, so this is not the first choice.
In this file, it can also be seen which other resources are used. If you for example what to make use of the 'filesystem', the EEPROM resources are used, but in a minimal setting, the timer is the only resource that is used.
So, to answer your main question, is it possible to use timer2 , the answer is yes. I do not remember completely for this chip, but is there are mixed control registers for timer0 and timer2, make sure you only manipulate the bits for timer2.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it Possible to use Timer/Counter2 of ATmega32 in femtoOS 0.92?
If possible, then how to use it and it's overflow vectors and other options?
If not, then why?
How femtoOS 0.92's OS tick Works? Which resources of microcontroller it use?
Dose femtoOS 0.92 use any timer for it's "OS ticks"?
N.B: (Though, I don't have much knowledge about OS, Question might be seems so STUPID....... sorry for that ... :-/ )
The shorter the question, the longer the answer. "How femtoOS 0.92's OS tick Works?", i can write several pages on that, for which i do certainly not have the time. In general, it works like any RTOS. There is a timer that generates an interrupt, and a context switch takes place to switch to a new task. However, in Femto OS much more is going on, since, to save memory, the OS, does not run on the task stack but has its own, and thus also a stack change is performed. In order to keep the overhead low it also determines if other tasks are due soon etc etc.
Depending on the chip the tick timer uses timer 0 or timer 2. This can be found in the devices file. For the ATmega32 that is /MainCode/femtoos_devices/femtoos_ATmega32A.asm under / Timer settings / you see what is used. This particular chip uses timer0, so 2 is free for own use, but you could, in principe, if you really need timer0 yourself for other purposes switch to timer2 for the tick. This may lead to unexpected behavior though, so this is not the first choice.
In this file, it can also be seen which other resources are used. If you for example what to make use of the 'filesystem', the EEPROM resources are used, but in a minimal setting, the timer is the only resource that is used.
So, to answer your main question, is it possible to use timer2 , the answer is yes. I do not remember completely for this chip, but is there are mixed control registers for timer0 and timer2, make sure you only manipulate the bits for timer2.