Home > other >  Single chip microcomputer: is there more simple method???????
Single chip microcomputer: is there more simple method???????

Time:09-20

A system with three external interrupt source IR1, IR2 and IR3, when an interrupt source interrupt request make pin a low electricity at ordinary times, asked the CPU for processing, their priority order from high to low for IR3, IR2, IR1, interrupt handler entry address of 1000 h, respectively, 1100 h, 1200 h, write the main program and interrupt service sub routine

ORG 0000 h

LJMP MAIN

ORG 0013 h

LJMP INT_EX1

ORG 0030 h

MAIN: CLR IT0; Trigger level, low level effective

SETB EX1. Allow the external interrupt 1

SETB EA. Insert the user program

WAIT: AJMP WAIT; Wait for interrupt

INT_EX1: JB P1.2, NEXT1; Judge IR3 interrupt

LJMP INT_IR3; Jump to IR3 interrupt handlers

NEXT1: JB P1.1, NEXT2; Judge IR2 interrupt

LJMP INT_IR2; Jump to IR2 interrupt handlers

NEXT2: LJMP INT_IR1; Jump to IR1 interrupt handlers

ORG 1000 h

INT_IR3: above handler

RETI; Interrupt return

ORG 1100 h

INT_IR2: above handler

RETI; Interrupt return

ORG 1200 h

INT_IR1: above handler

RETI; Interrupt return








  • Related