STC15W408AS library 0.12.0
Loading...
Searching...
No Matches
Macros
counter0_mode2.h File Reference
#include <stdint.h>
#include <assert.h>
#include <interrupt.h>
Include dependency graph for counter0_mode2.h:

Go to the source code of this file.

Macros

#define T0   P34
 T0 pin definition.
 
#define INT0   P32
 INT0 pin definition.
 
init

Counter initializaion functions

#define counter0_mode2_init()
 Initialize mode2 for counter0.
 
start/stop

Counter0 start/stop functions

#define counter0_mode2_start(value)
 Starts Counter 0 in Mode 2 with a specified initial value.
 
#define counter0_mode2_stop()
 Stop counter0.
 
#define is_counter0_mode2_started()   (TR0 == 1 && (is_counter0_mode2_gate_opened() || INT0 == 1) )
 Get counter0 mode2 started status.
 
read/write

Counter get and set value functions

#define counter0_mode2_get_value()   (TL0)
 get counter0 value in mode2
 
#define counter0_mode2_set_value(value)
 set counter0 value in mode2
 
config

Counter0 pin output and gate config functions

#define counter0_mode2_enable_P35_output()   (bit_set(INT_CLKO, SBIT0))
 enable output to P3.5
 
#define counter0_mode2_disable_P35_output()   (bit_clr(INT_CLKO, CBIT0))
 disable output to P3.5
 
#define is_counter0_mode2_P35_output_enabled()   (test_if_bit_set(INT_CLKO, SBIT0))
 get pin P3.5 output state to P3.5
 
#define counter0_mode2_open_gate()   (bit_clr(TMOD, CBIT3))
 Open counter0 gate.
 
#define counter0_mode2_close_gate()   (bit_set(TMOD, SBIT3))
 Close counter0 gate.
 
#define is_counter0_mode2_gate_opened()   (test_if_bit_cleared(TMOD, SBIT3))
 Get gate state.