Timer 2

Hello,I would like to use the timer 2 but I don’t know how to access the register (yes I’m a newbie). If someone can give me some advise or example… Thank you

have you checked the hardware reference guide? are you using net+os? what do you mean with ‘access the register’, which register do you want to access? normally you not only have to configure the timer but also to enable the timer interrupt.

Hi Math! It’s me again, I had some new experience with timers… If you have the parallel port disabled (#define BSP_INCLUDE_PARALLEL_DRIVER FALSE), timer 2 is absolutely free for your needs. And the best thing is: You don’t have to do any calculation about ticks, prescaler and so on. Just call netosSetupAuxClock. This sets the timer register automatically. Greets, Stefan

I am working with net+os6 and would like to use the timer2. To do that, the user guide says that I have to write in the timing register the values I want to use: TE=1 to enable the timer, TIE=1 to enable the interrupt and ITC=47 (the value I want to use for the TIMEOUT). What I want to know is if there are some functions already defined to configurate this timer. If there aren’t, how can I configurate the timer?

First you have to know that ThreadX uses timer 1 for its internal timebase and Net+OS uses timer 2 in some parallel port routines. So it is absolutely impossible to use timer 1. But if you don’t use the parallel port driver it must be possible to abuse Timer 2 for your own requirements. For your requirements the Net+OS timers are too slow so you’ll have no other choice than the use of timer 2. You’ll have to check the Net+OS code for any access to the timer 2 and comment it out. Perhaps someone else can tell you more about this… Access to the timer configuration register is a normal 32bit memory access: ((unsigned long volatile)0xffb00018)=0xc000002f; The timer interrupt configuration can be easily made in Net+OS using the function NAInstallIsr (with intlevel=4 for timer 2). Check the API reference for this. I hope I could help you… -stefan PS: The easiest way is to use the ThreadX timers. This is only for slow timeouts as fast as the OS tick.

Hi Uniton, Thank you for your help, the Timer 2 is working well now. Greets.