STC15W408AS library 0.10.0
|
Macros | |
#define | T2 P31 |
T2 pin definition. | |
init | |
Counter initializaion functions | |
#define | counter2_mode0_init() |
Initialize mode0 for counter2. | |
run | |
Counter run/stop/reload functions | |
#define | counter2_mode0_start(value) |
Run counter2. | |
#define | counter2_mode0_stop() |
Stop counter2. | |
#define | is_counter2_mode0_started() (test_if_bit_set(_AUXR, SBIT4)) |
Get counter2 mode0 started status. | |
read/write | |
Counter2 get and set value functions | |
#define | counter2_mode0_get_value() ((((uint16_t) T2H) << 8) | T2L) |
get counter2 value in mode0 | |
#define | counter2_mode0_set_value(value) |
set counter2 value in mode0 | |
config | |
Counter2 pin output and gate config functions | |
#define | counter2_mode0_enable_P30_output() (bit_set(INT_CLKO, SBIT2)) |
enable output to P3.0 | |
#define | counter2_mode0_disable_P30_output() (bit_clr(INT_CLKO, CBIT2)) |
disable output to P3.0 | |
#define | is_counter2_mode0_P30_output_enabled() (test_if_bit_set(INT_CLKO, SBIT2)) |
get pin P3.0 output state to P3.0 | |
Functions and data structures for counter2 mode0.
This module supports general purpose counter2. Mode0 is auto reload 16-bit counter..
Counter2 increments its value on T0 pin change state from 0 to 1. Once the counter reaches its maximum value of 65535, the counter is reset to zero at the next increment. On counter overflow reset interrupt 1 is raised.
#define counter2_mode0_disable_P30_output | ( | ) | (bit_clr(INT_CLKO, CBIT2)) |
disable output to P3.0
Disable pin P.3.0 state changes on counter2 overflow. By default P3.0 output is disabled
#define counter2_mode0_enable_P30_output | ( | ) | (bit_set(INT_CLKO, SBIT2)) |
enable output to P3.0
Enable pin P.3.0 state changes on counter2 overflow. By default P3.0 output is disabled
#define counter2_mode0_get_value | ( | ) | ((((uint16_t) T2H) << 8) | T2L) |
get counter2 value in mode0
#define counter2_mode0_init | ( | ) |
Initialize mode0 for counter2.
Enable counter2 interrupt and set mode0
#define counter2_mode0_set_value | ( | value | ) |
set counter2 value in mode0
Call this method before counter2 started.
value | uint16_t counter value to set |
#define counter2_mode0_start | ( | value | ) |
Run counter2.
Before run counter2_mode0_init should be called. After run counter2 is counted T0 pin state change. Interrupt handler void timer0ISR(void) __interrupt(1) should be defined in user code.
value | uint16_t initial counter value |
#define counter2_mode0_stop | ( | ) |
Stop counter2.
Stop count T0 pin state changes. Before stop counter2_start should be called.
#define is_counter2_mode0_P30_output_enabled | ( | ) | (test_if_bit_set(INT_CLKO, SBIT2)) |
get pin P3.0 output state to P3.0
#define is_counter2_mode0_started | ( | ) | (test_if_bit_set(_AUXR, SBIT4)) |
Get counter2 mode0 started status.