<< Previous | Next >>

set_cpu_power_mode

int set_cpu_power_mode( int mode, char clkDoubler, char shortChipSelect );

Description

Sets operating power of the controller. Suspend serial communication and other data transmission activity prior to calling this function, which sets higher priority interrupt while switching clock frequencies.

This function is non-reentrant.

Parameters

mode
Mode operation. Use the following table values below. (The higher the value the lower the power consumption of controller.)

Mode

Description

Comments

1 Cclk=Pclk=MainOsc Debug capable
2 Cclk=Pclk=MainOsc/2 Debug capable (19200 baud)
3 Cclk=Pclk=MainOsc/4 Debug capable (9600 baud)
4 Cclk=Pclk=MainOsc/6
5 Cclk=Pclk=MainOsc/8
6 Cclk=Pclk= 32.768KHz Periodic Interrupt disabled, so call hitwd()
7 Cclk=Pclk=32KHz/2=16.384KHz Periodic Interrupt disabled, so call hitwd()
8 Cclk=Pclk=32KHz/4 =8.192KHz Periodic Interrupt disabled, so call hitwd()
9 Cclk=Pclk=32KHz/8=4.096KHz Periodic Interrupt disabled, so call hitwd()
10 Cclk=Pclk=32kHz/16 =2.048KHz Periodic Interrupt disabled, so call hitwd()

clkDoubler
Clock doubler setting: CLKDOUBLER_ON or CLKDOUBLER_OFF.

CPU will operate at half selected speed when turned off. This parameter only affects main oscillator modes, not 32 kHZ oscillator modes. Turning Clock doubler off reduces power consumption.

shortChipSelect
Short Chip Select setting. Use SHORTCS_OFF, or SHORTCS_ON.

NOTE When short chip select is on, make sure that interrupts are disabled during I/O operations. Turning Short Chip Select on may reduce power consumption. See the Rabbit processor manual for more information regarding chip selects and low power operation.

Return Value

 0: valid parameter
-1: invalid parameter

Library

low_power.lib


Dynamic C Functions << Previous | Next >> rabbit.com