Changing clock rates in program
agimuhing
Posts: 39
Is it possible for a program to change the clock rate while running?
I'm looking for a way to make a sleep mode to reduce power usage
I'm looking for a way to make a sleep mode to reduce power usage
Comments
Very usefull methods! Thanks.
Is there a significant reduction of the power required when we slow down the propeller from 80 to 20 or 12?
Thanks,
JM
There are some stipulations. There is power that the propeller uses no matter at DC or 100MHz clock speed. There is power the propeller uses whether any cogs are running. It's all in the manual and/or datasheet. Look it up. Don't forget you have 5 options on the crystal 5/10/20/40/80 MHz (with a 5MHz crystal). You can get different options by using different crystals, to optimize the power consumption.
I have a battery operated project that during standby periods drops all cogs except one that runs at 5MHz. It runs (including hardware on my PCB) at about 8mA. But during normal operations it runs at 40MHz, with 6 or so cogs (some in various stages of waiting) it sucks about 60mA.
The 8mA standby is my most important time to save battery life. I have found my 3.3V regulator wastes about a third or a half of that. My next design has a far superior ULDO regulator that should have a quiecent current (according to my calculations) of about 700µA, so that will greatly reduce the power consumption during lower power mode.
Humanoido
Thanks for all those details! I think I will integrate all of that in my propeller! It will be installed on my car, so I don't want it to suck all the battery when I park it for the winter...
JM
Update: While in RCSLOW the display is gone (as expected). Switching back to 80MHz restores it.
If Hibernate '
If the Hibernate Flag is set then Slow and Wait
Hibernate:=false ' Clear Hibernate Flag
'
Repeat p from 1 to 7 ' Stop unecessary cogs to save power
Cogstop(p)
Clock.SetClock(rcfast) ' Slow clock to RC Slow ~ 20Khz to save power
dira[0..7]~ ' Set Pins to Input for watch
Repeat while ina[7..0]==0 ' Wait for ANY bilge pin to go high
test_bilge_leds ' Run method that sets pins to output in order to uses LEDs as a heart beat
waitcnt(clkfreq+cnt) ' Pause
dira[0..7]~ ' Set Pins back to Input for watch
Clock.SetClock(xtal1 + pll16x) ' After trigger reset clock to full speed = 80 mhz
tv.start(@tv_status) ' Restart TV object
gr.start ' Restart graphic object
gr.setup(16, 12, 128, 96, display_base) ' Reset graphics and point to video memory used
mm[1].Start(Starpin, @SPeriod, @SPulseCount) ' Relaunch Launch Starboard Motor Minder
mm[0].Start(Portpin, @PPeriod, @PPulseCount) ' Relaunch Port Motor Minder