TOP

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--------------------------
b0xchA,AccBuf; B0xch instruction do not change C,Z flag
b0movA,PFLAG 
B0MOVPflagBuf,A 
;---------interrupt first-------------------------
INT0CHK:
B0BTS1FT0IEN
JMPINTTC0CHK
B0BTS0FT0IRQ
JMPINTT0
INTTC0CHK:  ; Check TC0 interrupt request
B0BTS1FTC0IEN; Check TC0IEN
JMPISR90; Jump to exit of IRQ
B0BTS0FTC0IRQ; Check TC0IRQ
JMPINTTC0; Jump to TC0 interrupt service routine
;-------------exit interrupt-------------------------
ISR90:  
B0MOVA, PflagBuf
B0MOVPFLAG,A; Restore the PFlag
B0XCHA,AccBuf; Restore the Reg. A
  ; B0xch instruction do not change C,Z flag
RETI ; Exit the interrupt routine
;---------------------t0-----------------------------
INTT0:  
B0BCLRFT0IRQ
INTT090:  
JMPISR90
;---------------------tc0-----------------------------
INTTC0:  
B0BCLRFTC0IRQ
INTTC090:  
JMPISR90