µTasker Forum

µTasker Forum => Luminary Micro TM LM3SXXXX => Topic started by: phomann on May 05, 2010, 05:47:01 AM

Title: Creating a 25KHz interrupt
Post by: phomann on May 05, 2010, 05:47:01 AM
Mi Mark,

I want to create a 25Khz ISR to use for various timing functions, including a tasks run time. Is there anything in uTasker to support this type of ISR?

If not, are there any issues I may need to look out for? Presumably, the simulator will not be able to simulate this type of functionality.

Cheers,

Peter.
Title: Re: Creating a 25KHz interrupt
Post by: mark on May 05, 2010, 11:41:58 PM
Hi Peter

a 25kHz interrupt arrives once every 40us, which is fairly fast but should not cause a real problem (it is like handling UART transmissions in interrupt driven mode at about 275kHz, which shouldn't cause any difficulties). It will of course result in additional processor loading - the amount depending on the amount of work actually done in each interrupt.

Your may be able to set the TICK to this speed but its processing may result in a heavy load.

Alternatively you can use another periodic timer - see example TEST_TIMER and TEST_PERIODIC_TIMER in ADC_Timers.h and put your handling in its ISR.

The simulator will not be able to generate periodic timer interrupts must faster than about 10ms (set the TICK to 10ms when simulating - possibly conditional). Faster TICK values cause Windows to slow down and so the result doesn't get any quicker...

What you can however do - to compensate a bit - is to cause the ISR to be called say 250 times each time it fires in the simulator. This will mean that it will, on average, be called at the same rate as 40us but in bursts. This may (or may not) be suitable to test the code in the ISR to make the overall operation more realistic (otherwise you will just get one ISR call per TICK).

Does this help?

Regards

Mark



Title: Re: Creating a 25KHz interrupt
Post by: phomann on May 06, 2010, 06:12:58 AM
Hi Mark,

Thanks for all of that. I think I'll setup another timer for my interrupt. I don't really need to worry about the timulator side of things.

Cheers,

Peter.
Title: Re: Creating a 25KHz interrupt
Post by: phomann on May 07, 2010, 06:46:36 AM
Hi Mark,

It is working as expected on the target. Thanks for the help.

Cheers,

Peter.