Page 1 of 1

Adaptation to PIC using proprietary hardware

PostPosted: Fri Aug 10, 2001 8:25 am
by Unregistered User
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)?

Re: Adaptation to PIC using proprietary hardware

PostPosted: Fri Aug 10, 2001 8:29 am
by aek
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).]


Re: Adaptation to PIC using proprietary hardware

PostPosted: Fri Aug 10, 2001 8:47 am
by aek
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.

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


Re: Adaptation to PIC using proprietary hardware

PostPosted: Wed Jul 08, 2009 11:50 am
by tbims23822
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.