![]() |
Forum Index : Microcontroller and PC projects : PAUSE or CPU SLEEP ...
Author | Message | ||||
Taipan Newbie ![]() Joined: 02/01/2025 Location: AustraliaPosts: 8 |
I am confused about the use of PAUSE and CPU SLEEP as they each seem to achieve the same/similar result. Reading "between the lines" it looks like interrupts will be recognised during a PAUSE, but not during a CPU SLEEP? Is that correct? But, given that "the CPU does not have a true low power sleep so the power saving is limited", then I wonder at the point of CPU SLEEP. |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2611 |
The Pico is a recent addition to the MMBasic supported range of chips. The PIC32MX chips for example do have proper sleep modes. To maximize portability of code that command has been retained. Edited 2025-01-04 17:27 by phil99 |
||||
Taipan Newbie ![]() Joined: 02/01/2025 Location: AustraliaPosts: 8 |
So, for a Raspberry Pi Pico W, I should just use PAUSE as the Pico W does not have true low power sleep? And, interrupts will not be recognised during a CPU SLEEP? |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7870 |
You aren't the only one that's confused! PAUSE n waits for n milliseconds. During this time interrupts are still processed. The RP2040 has a condition called SLEEP: The manual states that both processors are put into a sleep state for n seconds, So I think it may be that no *normal* interrupts will be processed by MMBasic during this time, but internal interrupts may still wake one or both processors which will then sleep again. MMBasic needs things doing regularly. . Edited 2025-01-05 07:02 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2611 |
Your assumption is correct, this test program shows a Tick interrupt won't wake a Pico. Dim integer n And the outputSub wake Inc n Print "wake",n,Timer End Sub SetTick 2000, wake, 1 Timer = 0 Do CPU sleep 5 Print "woken",n Loop wake 1 5000.185 woken 1 wake 2 10000.499 woken 2 wake 3 15000.788 woken 3 wake 4 20001.047 but if 'CPU Sleep 5' is replaced with 'Pause 5000' it does get interrupted. Edited 2025-01-05 07:12 by phil99 |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |