Pumpkin, Inc.

Pumpkin User Forums

Adaptation to PIC using proprietary hardware

If you're interested in purchasing Salvo but have some questions you want answered first, post them here.

Adaptation to PIC using proprietary hardware

Postby Unregistered User » Fri Aug 10, 2001 8:25 am

Is the scheduler currently designed to take advantage of processor sleep
modes during idle times (i.e. using an independent timer such as TIMER1 on a
PIC)?
Unregistered User
 
Posts: 36
Joined: Thu Aug 09, 2001 11:00 pm

Re: Adaptation to PIC using proprietary hardware

Postby aek » Fri Aug 10, 2001 8:29 am

While we have not yet done a PIC16 sleep application (the PIC12 sleep application detailed in App Note AN-6 sleeps, but of course the PIC12C509 doesn't have interrupts, especially periodic ones, so this is more a case of wake-on-button-press to maximize battery life), it should be be trivial to implement in a Salvo application.

Basically, as long as all events (e.g. periodic wake-up via TIMER1, wake-up via keypress, etc.) wake the device from sleep, then the only modification to the usual Salvo application would be to add a sleep instruction to the application's main loop:

code:
main() 
{
...
for ( ; ; ) {
OSSched();
sleep();
}
}

In this situation, a TIMER1 interrupt (which calls OSTimer()) maintains the system's tick counter. After the interrupt, the scheduler runs and handles the highest-priority task that was made eligible by the timer.

Since it's possible that multiple tasks may have recently been made eligible, one should modify the main loop to look like this:

code:
main() 
{
...
for ( ; ; ) {
OSSched();
if ( !OSAnyEligibleTasks() )
sleep();
}
}

This sleep-mode-aware Salvo application will appear to the outside world no different from a non-sleeping application, as long as all the tasks are either delayed or waiting when not eligible. This is likely to be the situation you describe. One could not have (nor would one want) an idle task, because that would always be eligible, and it would prevent the PIC from sleeping.

I hope I have understood and answered your question correctly.

------------------

[This message has been edited by aek (edited August 10, 2001).]

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Adaptation to PIC using proprietary hardware

Postby aek » Fri Aug 10, 2001 8:47 am

A few more notes:

1) The system timer's resolution will be the rate at which TIMER1 generates interrupts and calls OSTimer().

2) The key here is that RTOS events (e.g. the expiration of a task's delay, or the signaling of a semaphore) are all preceded by a PIC event that wakes the device from sleep.

3) If you need a higher wake-from-sleep rate than the system tick rate required, you can use Salvo's timer prescalar.

4) Note that when OSTimer() is called and no task delays expire, the main loop will make a quick trip through the scheduler, find that no task is eligible, and go back to sleep.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Adaptation to PIC using proprietary hardware

Postby tbims23822 » Wed Jul 08, 2009 11:50 am

www.drop-shopping.com is a premium website for cheap air jordans shoes and other more really nike air jordan shoes.We have varity of cheap air jordan shoes available for wholesale.Cheap China wholesale shoes including cheap Nike shoes and cheap jordan shoes,nike sneakers,nike sneakers discount,air jordan sneakers,air force sneakers.We supply nike sneakers,jordan sneakers,air jordan sneakers,air force sneakers wholesale.You can buy very cheap jordans shoes including cheap women shoes,cheap nike shoes,cheap running shoes from us.

tbims23822
 


Return to Pre-Sales Inquiries

Who is online

Users browsing this forum: No registered users and 3 guests

cron