Interrupt-key control LED status, key led status

Source: Internet
Author: User

Interrupt-key control LED status, key led status

Program function: press the button to control the LED status and interrupt the implementation.
Symptom: When you press the k key, LED0 will always flash, thus affecting other LEDs.
Note: Use the Dupont wire to connect the P3.2 pin (INT0) to the switch K pin.

Program:

ORG 0000 h ljmp main org 0003 H; External Interrupt 0 entry LJMP INT0 ORG 0200 HMAIN: setb ea; enable total interrupt SETB EX0; enable external interrupt 0, that is, the CLR IT0 on the P3.2 pin; set it to the low-level trigger mode SJMP $; the main program only waits for the interruption INT0: DEC P1; the external interrupt 0 interrupt response, the content of the P1 port is reduced by 1 lcall delay; call the DELAY subroutine RETI; return DELAY: MOV R5, #255; latency subroutine D1: MOV R6, #255 DJNZ R6, $ DJNZ R5, D1 RET END

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.