|
STC15W408AS library 0.13.0
|
Macros | |
| #define | WIRC_H_ADDRESS 0xf8 |
| Wakeup timer internal clock frequency value high byte address. | |
| #define | WIRC_L_ADDRESS 0xf9 |
| Wakeup timer internal clock frequency value low byte address. | |
| #define | idle() (bit_set(PCON, SBIT0)) |
| Set MCU idle mode. | |
| #define | power_down() |
| Set MCU power down mode. | |
| #define | wakeup_timer_init(ticks) |
| Init and run wakeup timer. | |
| #define | wakeup_timer_internal_clk_freq() (((uint16_t)*wirc_h_ptr << 8) | *wirc_l_ptr) |
| Get wakeup timer internal clock frequency. | |
| #define | power_low_voltage_flag_get() (get_bit(PCON, 5)) |
| Retrieves the status of the low voltage detection flag. | |
| #define | power_low_voltage_flag_clear() (bit_clr(PCON, CBIT5)) |
| Clears the low voltage detection flag in the PCON register. | |
Functions and data structures related for MCU power management
| #define idle | ( | ) | (bit_set(PCON, SBIT0)) |
Set MCU idle mode.
Shuts off clock to CPU, but clock to Timers, Interrupts, Serial Ports, and Analog Peripherals are still active. The CPU status is preserved in its entirety: the RAM, Stack Pointer, Program Counter, Program Status Word, Accumulator, and all other registers maintain their data during Idle. The port pins hold the logical states they had at the time Idle was activated.
| #define power_down | ( | ) |
Set MCU power down mode.
In the Stop/Power-Down mode, the on-chip oscillator and the Flash memory are stopped in order to minimize power consumption. Only the power-on circuitry will continue to draw power during Stop/Power-Down. The contents of on-chip RAM and SFRs are maintained.
| #define power_low_voltage_flag_clear | ( | ) | (bit_clr(PCON, CBIT5)) |
Clears the low voltage detection flag in the PCON register.
This macro clears the low voltage detection flag by resetting bit 5 (CBIT5) of the PCON (Power Control) register. This flag is set when a low voltage condition is detected, and must be manually cleared by software.
| #define power_low_voltage_flag_get | ( | ) | (get_bit(PCON, 5)) |
Retrieves the status of the low voltage detection flag.
This macro reads the state of bit 5 (SBIT5) in the PCON (Power Control) register to determine if the low voltage detection flag is set. It is typically used in microcontrollers to check whether a low voltage condition has been detected during operation.
| #define wakeup_timer_init | ( | ticks | ) |
Init and run wakeup timer.
Wakeup time is calculated as (10^6/wakeup_timer_internal_clock_frequency) * 16 * ticks
| ticks | uint16_t wakeup timer ticks count |
| #define wakeup_timer_internal_clk_freq | ( | ) | (((uint16_t)*wirc_h_ptr << 8) | *wirc_l_ptr) |
Get wakeup timer internal clock frequency.
wakeup timer internal clock frequency after MCU powerup is placed in RAM __idata 0xf8-0xf9 adresses.
By default SDCC compiler generate firmware part that before main() call clear RAM and 0xf8-0xf9 contains 0x00 values.
To avoid memory clearing implement empty
void _mcs51_genRAMCLEAR() {} routine. Otherwise routine call return result 0x00.
Default value is 0x8c0a = 35850Hz.