Simple marquee program + interrupt handling

Source: Internet
Author: User

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/> 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.