EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Crossworks tasking library questions

Started by drproton2003 January 31, 2007
Hello everyone,

I've used the crossworks tasking library (CTL) in the past and it
works great. I want to modify a project to use the CTL. The problem
is that this application already ties up both timers of the LPC2138
for other purposes. My idea is to use ADC interrupt, set up the
prescaling and divide appropriatly in the ISR to effectively have a
portion of code called every 1ms. Can I simply just call
ctl_increment_tick_from_isr(); every 1ms and have the same
functionality as with a timer based ISR? Any potential pitfalls here?
Any better ways to do this?

Do I have to make any changes to the project to convert from a regular
project to a CTL project?

Is there a way to run the task scheduler at a frequency other than
1KHz? I expect the ISR could simply be modified to run at a different
frequency, but wouldn't this bugger up all the wait functions?

An Engineer's Guide to the LPC2100 Series

It doesn't matter where you call the
"ctl_increment_tick_from_isr()" from, just so long as
it is from an ISR. I use both timers for other
purposes as well but with so many match registers
surely you can make it work. You can increment the
tick at some other rate other than 1KHz. This just
means that timer ticks won't be at 1ms. Say you
increment it at 100Hz, then the time base will be
10ms.

--- drproton2003 wrote:

> Hello everyone,
>
> I've used the crossworks tasking library (CTL) in
> the past and it
> works great. I want to modify a project to use the
> CTL. The problem
> is that this application already ties up both timers
> of the LPC2138
> for other purposes. My idea is to use ADC
> interrupt, set up the
> prescaling and divide appropriatly in the ISR to
> effectively have a
> portion of code called every 1ms. Can I simply just
> call
> ctl_increment_tick_from_isr(); every 1ms and have
> the same
> functionality as with a timer based ISR? Any
> potential pitfalls here?
> Any better ways to do this?
>
> Do I have to make any changes to the project to
> convert from a regular
> project to a CTL project?
>
> Is there a way to run the task scheduler at a
> frequency other than
> 1KHz? I expect the ISR could simply be modified to
> run at a different
> frequency, but wouldn't this bugger up all the wait
> functions?

____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com. Try it now.
--- In l..., "drproton2003" wrote:
>
> Hello everyone,
>
> I've used the crossworks tasking library (CTL) in the past and it
> works great. I want to modify a project to use the CTL. The problem
> is that this application already ties up both timers of the LPC2138
> for other purposes. My idea is to use ADC interrupt, set up the
> prescaling and divide appropriatly in the ISR to effectively have a
> portion of code called every 1ms. Can I simply just call
> ctl_increment_tick_from_isr(); every 1ms and have the same
> functionality as with a timer based ISR? Any potential pitfalls here?
> Any better ways to do this?

This is okay. If you don't use the timeouts on the wait calls (or the
timeslicing feature) then you don't need to provide a timer at all.

>
> Do I have to make any changes to the project to convert from a regular
> project to a CTL project?

Yes.

The file "VIC_irq_handler.s" will need to have the preprocessor define
CTL_TASKING set.

You will need to set "Use Multi Threaded Libraries" linker property.

You can reference the built libraries by setting the "Additional Input
Files" linker property to be "$(StudioDir)/ctl/lib/libctl$(LibExt).a"
or alternatively add the (ctl_*) source files in the directory
$(Studio)/ctl/source to your project.

When you set project properties remember to select the "Common"
configuration so they will apply to RAM/Flash and ARM/Thumb builds.

>
> Is there a way to run the task scheduler at a frequency other than
> 1KHz? I expect the ISR could simply be modified to run at a different
> frequency, but wouldn't this bugger up all the wait functions?
>

All of the wait functions are done in terms of ticks. You can change
the frequency to match your needs.

Regards
Michael

The 2024 Embedded Online Conference