STC15W408AS library 0.9.0
|
init | |
Timer initializaion functions | |
#define | timer2_mode0_12T_init() |
Initialize mode0 12T for timer2. More... | |
#define | timer2_mode0_1T_init() |
Initialize mode0 1T for timer2. More... | |
config | |
Timer configuration functions | |
#define | timer2_mode0_enable_P30_output() (bit_set(INT_CLKO, SBIT2)) |
Enable output of meander with timer times on P3.0 pin. More... | |
#define | timer2_mode0_disable_P30_output() (bit_clr(INT_CLKO, CBIT2)) |
Disable output of meander with timer times on P3.0 pin. | |
#define | is_timer2_mode0_P30_output_enabled() (test_if_bit_set(INT_CLKO, SBIT2)) |
run in async mode | |
Timer run/stop/reload functions | |
#define | timer2_mode0_start(ticks) |
Run timer2 mode0 with interrupt support. More... | |
#define | timer2_mode0_direct_start(th0, tl0) |
Run timer2 mode0 with direct set of TH0 and TL0 registers. More... | |
#define | timer2_mode0_stop() |
Stop timer2 mode0. More... | |
#define | timer2_mode0_reload(ticks) |
Reload timer2 ticks on the fly. More... | |
#define | timer2_mode0_direct_reload(th2, tl2) |
Reload timer2 T2H and T2L registers on the fly. More... | |
#define | is_timer2_mode0_started() (test_if_bit_set(AUXR, SBIT4)) |
Get timer2 started status. More... | |
baud rate enable/disable | |
Select timer2 as UART1 baud rate generator | |
#define | timer2_mode0_enable_as_uart1_baud_rate() (bit_set(AUXR, SBIT0)) |
Select timer2 as uart1 baud rate generator. More... | |
#define | timer2_mode0_disable_as_uart1_baud_rate() (bit_clr(AUXR, CBIT0)) |
Unselect timer2 as uart1 baud rate generator. More... | |
#define | is_timer2_mode0_as_uart1_baud_rate_enabled() (test_if_bit_set(AUXR, SBIT0)) |
Is timer0 used as UART1 baud rate generator? More... | |
Functions and data structures for timer2 mode0.
Timer can work as COUNTER or TIMER.
Counter increments on external singnal (like pin 1/0 change state).
8051 chips timer2
For timer:
Timer2 mode0 can be used in sync (main prorgam flow blocked until timer overloaded) and interrupt (call interrupt handler on timer overloaded) modes.
#define is_timer2_mode0_as_uart1_baud_rate_enabled | ( | ) | (test_if_bit_set(AUXR, SBIT0)) |
Is timer0 used as UART1 baud rate generator?
by default timer0 used as UART1 baud rate generator
#define is_timer2_mode0_P30_output_enabled | ( | ) | (test_if_bit_set(INT_CLKO, SBIT2)) |
Get output to pin P3.0 output flag enabled value
#define is_timer2_mode0_started | ( | ) | (test_if_bit_set(AUXR, SBIT4)) |
Get timer2 started status.
#define timer2_mode0_12T_init | ( | ) |
Initialize mode0 12T for timer2.
Timer2 could be used for UART. This method init timer2 as general purpose timer in mode0 with input from sysClk/12. Using timer2 in this mode disable UART capability.
#define timer2_mode0_1T_init | ( | ) |
Initialize mode0 1T for timer2.
Timer2 could be used for UART. This method init timer2 as general purpose timer in mode0 with input from sysClk/1. Using timer2 in this mode disable UART capability.
#define timer2_mode0_direct_reload | ( | th2, | |
tl2 | |||
) |
Reload timer2 T2H and T2L registers on the fly.
Reload is available in mode 0 only
th2 | uint8_t T2H value |
tl2 | uint8_t T2L value |
#define timer2_mode0_direct_start | ( | th0, | |
tl0 | |||
) |
Run timer2 mode0 with direct set of TH0 and TL0 registers.
Before run timer2_mode0_12T_init or timer2_mode0_1T_init should be called.
After run program flow not blocked and interrupt will raised when timer is overloaded. Interrupt handler void timer2ISR(void) __interrupt(12) should be defined in user code.
Timer rerun occurs after overloading and interuppt handler calling. Timer overloading occurs when [TH0, TL0] = 0xff + 1
th0 | uint8_t TH0 value |
tl0 | uint8_t TL0 value |
#define timer2_mode0_disable_as_uart1_baud_rate | ( | ) | (bit_clr(AUXR, CBIT0)) |
Unselect timer2 as uart1 baud rate generator.
by default timer0 used as UART1 baud rate generator
#define timer2_mode0_enable_as_uart1_baud_rate | ( | ) | (bit_set(AUXR, SBIT0)) |
Select timer2 as uart1 baud rate generator.
by default timer0 used as UART1 baud rate generator
#define timer2_mode0_enable_P30_output | ( | ) | (bit_set(INT_CLKO, SBIT2)) |
Enable output of meander with timer times on P3.0 pin.
By default output is disabled
#define timer2_mode0_reload | ( | ticks | ) |
Reload timer2 ticks on the fly.
Reload is available in mode 0 only
ticks | uint16_t timer ticks reloaded value |
#define timer2_mode0_start | ( | ticks | ) |
Run timer2 mode0 with interrupt support.
Before run timer2_mode0_12T_init or timer2_mode0_1T_init should be called.
After run program flow not blocked and interrupt will raised when timer is overloaded.
Interrupt handler void timer2ISR(void) __interrupt(12) should be defined in user code.
Timer rerun occurs after overloading and interuppt handler calling.
ticks | uint16_t timer tick count |
#define timer2_mode0_stop | ( | ) |
Stop timer2 mode0.
Before stop timer2_mode0_start should be called.