STC15W408AS library 0.9.0
|
Macros | |
#define | enable_mcu_interrupts() (EA = 1) |
Enable interrupts support of MCU. More... | |
#define | disable_mcu_interrupts() (EA = 0) |
Disable interrupts support of MCU. More... | |
#define | is_mcu_interrupts_enabled() (EA == 1) |
#define | enable_low_voltage_interrupt() (ELVD = 1) |
Enable low voltage interrupt. More... | |
#define | disable_low_voltage_interrupt() (ELVD = 0) |
Disable low voltage interrupt. More... | |
#define | is_low_voltage_interrupt_enabled() (ELVD == 1 && is_mcu_interrupts_enabled()) |
Get low voltage interrupt enable status. More... | |
#define | enable_adc_interrupt() (EADC = 1) |
Enable ADC interrupt. More... | |
#define | disable_adc_interrupt() (EADC = 0) |
Disable ADC interrupt. More... | |
#define | is_adc_interrupt_enabled() (EADC == 1 && is_mcu_interrupts_enabled()) |
Get ADC interrupt enable status. More... | |
#define | enable_uart1_interrupt() (ES = 1) |
Enable UART1 interrupt. More... | |
#define | disable_uart1_interrupt() (ES = 0) |
Disable UART1 interrupt. More... | |
#define | is_uart1_interrupt_enabled() (ES == 1 && is_mcu_interrupts_enabled()) |
Get UART1 interrupt enable status. More... | |
#define | enable_int0_interrupt() (EX0 = 1) |
Enable INT0 interrupt. More... | |
#define | disable_int0_interrupt() (EX0 = 0) |
Disable INT0 interrupt. More... | |
#define | is_int0_interrupt_enabled() (EX0 == 1 && is_mcu_interrupts_enabled()) |
Get INT0 interrupt enable status. More... | |
#define | enable_int1_interrupt() (EX1 = 1) |
Enable INT1 interrupt. More... | |
#define | disable_int1_interrupt() (EX1 = 0) |
Disable INT1 interrupt. More... | |
#define | is_int1_interrupt_enabled() (EX1 == 1 && is_mcu_interrupts_enabled()) |
Get INT1 interrupt enable status. More... | |
#define | enable_int2_interrupt() (bit_set(INT_CLKO, SBIT4)) |
Enable INT2 interrupt. More... | |
#define | disable_int2_interrupt() (bit_clr(INT_CLKO, CBIT4)) |
Disable INT2 interrupt. More... | |
#define | is_int2_interrupt_enabled() (test_if_bit_set(INT_CLKO, SBIT4) && is_mcu_interrupts_enabled()) |
Get INT2 interrupt enable status. More... | |
#define | enable_int3_interrupt() (bit_set(INT_CLKO, SBIT5)) |
Enable INT3 interrupt. More... | |
#define | disable_int3_interrupt() (bit_clr(INT_CLKO, CBIT5)) |
Disable INT3 interrupt. More... | |
#define | is_int3_interrupt_enabled() (test_if_bit_set(INT_CLKO, SBIT5) && is_mcu_interrupts_enabled()) |
Get INT3 interrupt enable status. More... | |
#define | enable_int4_interrupt() (bit_set(INT_CLKO, SBIT6)) |
Enable INT4 interrupt. More... | |
#define | disable_int4_interrupt() (bit_clr(INT_CLKO, CBIT6)) |
Disable INT3 interrupt. More... | |
#define | is_int4_interrupt_enable() (test_if_bit_set(INT_CLKO, SBIT6) && is_mcu_interrupts_enabled()) |
Get INT4 interrupt enable status. More... | |
#define | enable_timer0_interrupt() (ET0 = 1) |
Enable timer0 interrupt. More... | |
#define | disable_timer0_interrupt() (ET0 = 0) |
Enable timer0 interrupt. More... | |
#define | is_timer0_interrupt_enabled() (ET0 == 0 && is_mcu_interrupts_enabled()) |
Get timer0 interrupt enable status. More... | |
#define | enable_timer2_interrupt() (bit_set(IE2, SBIT2)) |
Enable timer2 interrupt. More... | |
#define | disable_timer2_interrupt() (bit_clr(IE2, CBIT2)) |
Disable timer2 interrupt. More... | |
#define | is_timer2_interrupt_enabled() (test_if_bit_set(IE2, SBIT2) && is_mcu_interrupts_enabled()) |
Get timer2 interrupt enable status. More... | |
#define | enable_spi_interrupt() (bit_set(IE2, SBIT1)) |
Enable SPI interrupt. More... | |
#define | disable_spi_interrupt() (bit_clr(IE2, CBIT1)) |
Disable SPI interrupt. More... | |
#define | is_spi_interrupt_enabled() (test_if_bit_set(IE2, SBIT1) && is_mcu_interrupts_enabled()) |
Get SPI interrupt enable status. More... | |
#define | set_pca_interrupt_priority(priority) (PPCA = priority) |
Set programmable counter arrya (PCA) interrupt priority. More... | |
#define | get_pca_interrupt_priority() (PPCA) |
Get programmable counter arrya (PCA) interrupt priority. More... | |
#define | set_low_voltage_interrupt_priority(priority) (PLVD = priority) |
Set low voltage (LVD) interrupt priority. More... | |
#define | get_low_voltage_interrupt_priority() (PVLD) |
Get low voltage interrupt (LVD) priority. More... | |
#define | set_adc_interrupt_priority(priority) (PADC = priority) |
Set analog to digital converter (ADC) interrupt priority. More... | |
#define | get_adc_interrupt_priority() (PADC) |
Get analog to digital converter (ADC) interrupt priority. More... | |
#define | set_uart1_interrupt_priority(priority) (PS = priority) |
Set UART1 interrupt priority. More... | |
#define | get_uart1_interrupt_priority() (PS) |
Get UART1 interrupt priority. More... | |
#define | set_int0_interrupt_priority(priority) (PX0 = priority) |
Set INT0 interrupt priority. More... | |
#define | get_int0_interrupt_priority() (PX0) |
Get INT0 interrupt priority. More... | |
#define | set_int1_interrupt_priority(priority) (PX1 = priority) |
Set INT1 interrupt priority. More... | |
#define | get_int1_interrupt_priority() (PX1) |
Get INT1 interrupt priority. More... | |
#define | set_timer0_interrupt_priority(priority) (PT0 = priority) |
Set timer0 interrupt priority. More... | |
#define | get_timer0_interrupt_priority() (PT0) |
Get timer0 interrupt priority. More... | |
#define | set_spi_interrupt_priority(priority) (priority == HIGH ? bit_set(IP2, SBIT1) : bit_clr(IP2, CBIT1)) |
Set SPI interrupt priority. More... | |
#define | get_spi_interrupt_priority() (test_if_bit_set(IP2, SBIT1)) |
Get SPI interrupt priority. More... | |
#define | set_int0_interrupt_trigger(trigger) ( IT0 = trigger) |
Set INT0 interrupt trigger. More... | |
#define | get_int0_interrupt_trigger() (IT0) |
Get INT0 interrupt trigger. More... | |
#define | set_int1_interrupt_trigger(trigger) (IT1 = trigger) |
Set INT1 interrupt trigger. More... | |
#define | get_int1_interrupt_trigger() (IT1) |
Get INT1 interrupt trigger. More... | |
Enumerations | |
enum | interrupt_priority_t { LOW = 0 , HIGH = 1 } |
enum | external_interrupt_trigger_t { RAISING_OR_FALLING_EDGE = 0 , ONLY_FALLING_EDGE = 1 } |
Functions and data structures for interrupts. Interrupts are controlled by registers IE and IE2 bits.
Interrupts at all can be enabled, disabled and readed by enable_mcu_interrupts(), disable_mcu_interrupts and is_mcu_interrupts_enabled() routines.
Each kind of interrupt source controlled by enable_<source>_interrupt, disable_<source>_interrupt routines. The state of each kind of interrupt source can be probed by is_<source>_interrupts_enabled() routine. If mcu interrupts support not enabled individual interrupt sources are disabled too and is_<source>_interrupts_enabled() call return false.
Interrupt handler should be declared as:
The name of handler routine can be any correct C function name. Hanlder should have empty parameter list. Keyword __interrupt and interrupt number assign handler to specified interrupt. See STC15series MCU Data Sheet Section 6.4.
# | Description |
---|---|
0 | INT0 |
1 | Timer0 interrrupt |
2 | INT1 |
3 | Timer1 interrupt (STC15W408AS has no this timer) |
4 | UART1 interrupt |
5 | ADC interrupt |
6 | Low voltage detection (LVD) interrupt |
7 | PCA interrupt |
8 | UART2 interrupt |
9 | SPI interrupt |
10 | INT2 |
11 | INT3 |
12 | Timer2 interrupt |
13 | PWM interrupt |
16 | INT4 |
17 | S3 |
18 | S4 |
19 | Timer3 interrupt (STC15W408AS has no this timer) |
20 | Timer4 interrupt (STC15W408AS has no this timer) |
21 | Comparator interrupt |
For interrupt priority set_<source>_interrupt_priority(priority enum value) and get _<source>_interrupt_priority() routines should be used.
For INT0 and INT1 trigger configration set_<int0 or int1>_interrupt_trigger(trigger enum value) and get_<int0 or int1>_interrupt_trigger() routines should be used.
#define disable_adc_interrupt | ( | ) | (EADC = 0) |
Disable ADC interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_int0_interrupt | ( | ) | (EX0 = 0) |
Disable INT0 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_int1_interrupt | ( | ) | (EX1 = 0) |
Disable INT1 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_int2_interrupt | ( | ) | (bit_clr(INT_CLKO, CBIT4)) |
Disable INT2 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_int3_interrupt | ( | ) | (bit_clr(INT_CLKO, CBIT5)) |
Disable INT3 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_int4_interrupt | ( | ) | (bit_clr(INT_CLKO, CBIT6)) |
Disable INT3 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_low_voltage_interrupt | ( | ) | (ELVD = 0) |
Disable low voltage interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_mcu_interrupts | ( | ) | (EA = 0) |
Disable interrupts support of MCU.
Set EA to 0 to disable interrupt support. By default interrupts support are disabled Each interrupt should be enabled implicitly by setting its own flag
#define disable_spi_interrupt | ( | ) | (bit_clr(IE2, CBIT1)) |
Disable SPI interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_timer0_interrupt | ( | ) | (ET0 = 0) |
Enable timer0 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_timer2_interrupt | ( | ) | (bit_clr(IE2, CBIT2)) |
Disable timer2 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define disable_uart1_interrupt | ( | ) | (ES = 0) |
Disable UART1 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_adc_interrupt | ( | ) | (EADC = 1) |
Enable ADC interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_int0_interrupt | ( | ) | (EX0 = 1) |
Enable INT0 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_int1_interrupt | ( | ) | (EX1 = 1) |
Enable INT1 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_int2_interrupt | ( | ) | (bit_set(INT_CLKO, SBIT4)) |
Enable INT2 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_int3_interrupt | ( | ) | (bit_set(INT_CLKO, SBIT5)) |
Enable INT3 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_int4_interrupt | ( | ) | (bit_set(INT_CLKO, SBIT6)) |
Enable INT4 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_low_voltage_interrupt | ( | ) | (ELVD = 1) |
Enable low voltage interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_mcu_interrupts | ( | ) | (EA = 1) |
Enable interrupts support of MCU.
Set EA to 1 to enable interrupt support. By default interrupts support are disabled Each interrupt should be enabled implicitly by setting its own flag
#define enable_spi_interrupt | ( | ) | (bit_set(IE2, SBIT1)) |
Enable SPI interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_timer0_interrupt | ( | ) | (ET0 = 1) |
Enable timer0 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_timer2_interrupt | ( | ) | (bit_set(IE2, SBIT2)) |
Enable timer2 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define enable_uart1_interrupt | ( | ) | (ES = 1) |
Enable UART1 interrupt.
Before call this method mcu interrupt support should be enabled by calling enable_mcu_interrupts()
#define get_adc_interrupt_priority | ( | ) | (PADC) |
Get analog to digital converter (ADC) interrupt priority.
#define get_int0_interrupt_priority | ( | ) | (PX0) |
Get INT0 interrupt priority.
#define get_int0_interrupt_trigger | ( | ) | (IT0) |
Get INT0 interrupt trigger.
By default trigger initialized with RAISING_OR_FALLING_EDGE value
#define get_int1_interrupt_priority | ( | ) | (PX1) |
Get INT1 interrupt priority.
#define get_int1_interrupt_trigger | ( | ) | (IT1) |
Get INT1 interrupt trigger.
By default trigger initialized with RAISING_OR_FALLING_EDGE value
#define get_low_voltage_interrupt_priority | ( | ) | (PVLD) |
Get low voltage interrupt (LVD) priority.
#define get_pca_interrupt_priority | ( | ) | (PPCA) |
Get programmable counter arrya (PCA) interrupt priority.
#define get_spi_interrupt_priority | ( | ) | (test_if_bit_set(IP2, SBIT1)) |
Get SPI interrupt priority.
#define get_timer0_interrupt_priority | ( | ) | (PT0) |
Get timer0 interrupt priority.
#define get_uart1_interrupt_priority | ( | ) | (PS) |
Get UART1 interrupt priority.
#define is_adc_interrupt_enabled | ( | ) | (EADC == 1 && is_mcu_interrupts_enabled()) |
Get ADC interrupt enable status.
Get mcu interrupt and ADC interrupt support status
#define is_int0_interrupt_enabled | ( | ) | (EX0 == 1 && is_mcu_interrupts_enabled()) |
Get INT0 interrupt enable status.
Get mcu interrupt and INT0 interrupt support status
#define is_int1_interrupt_enabled | ( | ) | (EX1 == 1 && is_mcu_interrupts_enabled()) |
Get INT1 interrupt enable status.
Get mcu interrupt and INT1 interrupt support status
#define is_int2_interrupt_enabled | ( | ) | (test_if_bit_set(INT_CLKO, SBIT4) && is_mcu_interrupts_enabled()) |
Get INT2 interrupt enable status.
Get mcu interrupt and INT2 interrupt support status
#define is_int3_interrupt_enabled | ( | ) | (test_if_bit_set(INT_CLKO, SBIT5) && is_mcu_interrupts_enabled()) |
Get INT3 interrupt enable status.
Get mcu interrupt and INT3 interrupt support status
#define is_int4_interrupt_enable | ( | ) | (test_if_bit_set(INT_CLKO, SBIT6) && is_mcu_interrupts_enabled()) |
Get INT4 interrupt enable status.
Get mcu interrupt and INT4 interrupt support status
#define is_low_voltage_interrupt_enabled | ( | ) | (ELVD == 1 && is_mcu_interrupts_enabled()) |
Get low voltage interrupt enable status.
Get mcu interrupt and low voltage interrupt support status
#define is_mcu_interrupts_enabled | ( | ) | (EA == 1) |
Get MCU interrupts support state
#define is_spi_interrupt_enabled | ( | ) | (test_if_bit_set(IE2, SBIT1) && is_mcu_interrupts_enabled()) |
Get SPI interrupt enable status.
Get mcu interrupt and SPI interrupt support status
#define is_timer0_interrupt_enabled | ( | ) | (ET0 == 0 && is_mcu_interrupts_enabled()) |
Get timer0 interrupt enable status.
Get mcu interrupt and timer0 interrupt support status
#define is_timer2_interrupt_enabled | ( | ) | (test_if_bit_set(IE2, SBIT2) && is_mcu_interrupts_enabled()) |
Get timer2 interrupt enable status.
Get mcu interrupt and timer2 interrupt support status
#define is_uart1_interrupt_enabled | ( | ) | (ES == 1 && is_mcu_interrupts_enabled()) |
Get UART1 interrupt enable status.
Get mcu interrupt and UART1 interrupt support status
#define set_adc_interrupt_priority | ( | priority | ) | (PADC = priority) |
Set analog to digital converter (ADC) interrupt priority.
priority | interrupt priority |
#define set_int0_interrupt_priority | ( | priority | ) | (PX0 = priority) |
Set INT0 interrupt priority.
Parameter has type interrupt_priority_t and means interrupt priority
#define set_int0_interrupt_trigger | ( | trigger | ) | ( IT0 = trigger) |
Set INT0 interrupt trigger.
trigger | RAISING_OR_FALLING_EDGE or ONLY_FALLING_EDGE |
#define set_int1_interrupt_priority | ( | priority | ) | (PX1 = priority) |
Set INT1 interrupt priority.
priority | interrupt_priority_t interrupt priority |
#define set_int1_interrupt_trigger | ( | trigger | ) | (IT1 = trigger) |
Set INT1 interrupt trigger.
trigger | RAISING_OR_FALLING_EDGE or ONLY_FALLING_EDGE |
#define set_low_voltage_interrupt_priority | ( | priority | ) | (PLVD = priority) |
Set low voltage (LVD) interrupt priority.
priority | interrupt priority |
#define set_pca_interrupt_priority | ( | priority | ) | (PPCA = priority) |
Set programmable counter arrya (PCA) interrupt priority.
priority | interrupt priority |
#define set_spi_interrupt_priority | ( | priority | ) | (priority == HIGH ? bit_set(IP2, SBIT1) : bit_clr(IP2, CBIT1)) |
Set SPI interrupt priority.
priority | interrupt_priority_t interrupt priority |
#define set_timer0_interrupt_priority | ( | priority | ) | (PT0 = priority) |
Set timer0 interrupt priority.
priority | interrupt_priority_t interrupt priority |
#define set_uart1_interrupt_priority | ( | priority | ) | (PS = priority) |
Set UART1 interrupt priority.
Parameter has type interrupt_priority_t and means interrupt priority
enum interrupt_priority_t |