L use the External Interrupt trigger function of p3.2 to generate external interrupt 0 through buttons
L The main program is a common marquee Program
L when the main program is executed, press the p3.2 key to generate external interrupt 0 and enter the Interrupt Processing Program
L remember the number of buttons and display them on the indicator. When the button is set to N, the 1-N lights of the indicator are lit and blinking for n times.
L when the display light flashes, all other interruptions are blocked. After the interruption is returned, the marquee program returns to the position where the previous interruption was resumed.
L when all eight indicator lights are on, the count is cleared and everything starts from scratch
Org 0000 h <br/> ajmp main <br/> org 0003 H <br/> ajmp inser <br/> org 0030 H <br/> main: <br/> mov r0, #0 h; <br/> mov R1, # 0ffh; <br/> mov R2, #0 h <br/> mov R4, # 0xfe <br/> SETB ex0 <br/> CLR it0 <br/> SETB Ea <br/> mov P1, # 0ffh <br/> loop1: <br/> mov P1, R4 <br/> lcall delay <br/> mov A, R4 <br/> rl a <br/> mov R4, A <br/> ajmp loop1 <br/> inser: <br/> cjne r0, #08 h, next <br/> mov r0, #0 h <br/> mov P0, #0 h <br/> mov R1, # 0ffh <br/> next: <br/> push 05 <br/> push 06 <br/> push 07 <br/> Inc R0 <br/> mov A, R0 <br/> mov R2, A <br/> mov A, R1 <br/> rl a <br/> dec A <br/> loop2: <br/> mov P1, # 0ffh; <br/> lcall delay <br/> mov P1, A <br/> lcall delay <br/> djnz R2, loop2 <br/> mov P1, # 0ffh; <br/> mov R1, A <br/> pop 07 <br/> pop 06 <br/> pop 05 <br/> reti <br/> delay: mov R5, #20 <br/> d1: mov R6, #40 <br/> D2: mov R7, #248 <br/> djnz R7, $ <br/> djnz R6, d2 <br/> djnz R5, D1 <br/> RET <br/> end <br/>