Does SONIX MCU have interrupt priorities? How to set?
SONIX MCU hardware does not have interrupt priorities. However, in application,
there may require interrupt priority, user can achieve it according to SONIX MCU characteristics
by software.
For each interrupt Priority settings, and the system determine
whether response interrupt request according to the state of IEN and IRQ. Users must
check the interrupt control bits and interrupt request flag bits in interrupt vector,
so the higher priority interrupt control bits and interrupt request flag bits can
be set in the front for check.
For example:
ISR: | |||
;------------Save ACC-------------------------- | |||
b0xch | A,AccBuf | ; B0xch instruction do not change C,Z flag | |
b0mov | A,PFLAG | ||
B0MOV | PflagBuf,A | ||
;---------interrupt first------------------------- | |||
INT0CHK: | |||
B0BTS1 | FT0IEN | ||
JMP | INTTC0CHK | ||
B0BTS0 | FT0IRQ | ||
JMP | INTT0 | ||
INTTC0CHK: | ; Check TC0 interrupt request | ||
B0BTS1 | FTC0IEN | ; Check TC0IEN | |
JMP | ISR90 | ; Jump to exit of IRQ | |
B0BTS0 | FTC0IRQ | ; Check TC0IRQ | |
JMP | INTTC0 | ; Jump to TC0 interrupt service routine | |
;-------------exit interrupt------------------------- | |||
ISR90: | |||
B0MOV | A, PflagBuf | ||
B0MOV | PFLAG,A | ; Restore the PFlag | |
B0XCH | A,AccBuf | ; Restore the Reg. A | |
; B0xch instruction do not change C,Z flag | |||
RETI | ; Exit the interrupt routine | ||
;---------------------t0----------------------------- | |||
INTT0: | |||
B0BCLR | FT0IRQ | ||
INTT090: | |||
JMP | ISR90 | ||
;---------------------tc0----------------------------- | |||
INTTC0: | |||
B0BCLR | FTC0IRQ | ||
INTTC090: | |||
JMP | ISR90 |