The high four bits of the microcontroller P1 port are used as buttons, and the low four bits are used as output display program

Publisher:BlossomBeautyLatest update time:2015-10-10 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
;There is a corresponding C51 program
;This program mainly reflects the design of the button based on the single-chip microcomputer,
;Use the lower eight-bit LED display of P1 port, just to show the experimental results
;2007-06-05
             org            0000h
             ljmp start
             org            0060h
start:
             mov          a,#0f0h            ;Prepare to set the upper four bits of P1 port to high for inputmov
             p1          ,a               ;Set the upper four bits of P1 port to highmov
             a          ,p1               ;Read P1 portswap
             a          ;                 Exchange the upper four bits and lower four bits of A, and put the upper four bits of P1 port data to the lower four
             bitsanl           a,#0fh          ;Shield the upper four bits, remove the upper four bits that do not need to be displayed, or do not remove them, which will not affect the displaymov
             p1           ,a              ;Send the read number to P1 port for display (displayed through the LED connected to the lower four bits of P1 port)
             ljmp start   ;               Rescanend
          
Keywords:MCU Reference address:The high four bits of the microcontroller P1 port are used as buttons, and the low four bits are used as output display program

Previous article:Design of frequency meter based on single chip microcomputer (C51 language)
Next article:Serial communication program for two 51 single-chip microcomputers to communicate with each other

Recommended ReadingLatest update time:2024-11-15 15:32

Get key value MC51 microcontroller subroutine example
; Get key value program  ;Function: Wait for input, refresh the display, and return the key value to A ; Occupancy: PSW, A, DPTR, R0, R2, R3, R4, R6, R7 ;Entrance: None Exit: A      ORG 0190H WAT_KB: MOV R0,#3FH WAT_0: ACALL DISP_0 ; Refresh the display     ACALL   T_KB     JZ WAT_0 ;No key, loop     ACALL K
[Microcontroller]
MCU key debounce program
Usually, the switches used for buttons are mechanical elastic switches. When the mechanical contacts are opened and closed, due to the elastic effect of the mechanical contacts, a button switch will not be stably connected immediately when closed, nor will it be completely disconnected at once when disconnected. Instea
[Microcontroller]
MCU key debounce program
AVR microcontroller infrared remote control key value decoding experiment
AVR Learning Notes XVIII: Infrared Remote Control Key Value Decoding Experiment   18.1 Example Function  Infrared remote control is currently the most widely used means of communication and remote control. Since infrared remote control devices have the characteristics of small size, low power consumption, strong func
[Microcontroller]
AVR microcontroller infrared remote control key value decoding experiment
AT89S52 MCU Interrupt System
   The interrupt system of the AT89S52 microcontroller has a total of 8 interrupt sources, 6 interrupt vectors, and two-level interrupt priority. It can realize two-level interrupt service program nesting, and shield or allow corresponding interrupt requests through software. Each interrupt source can be programmed as
[Microcontroller]
AT89S52 MCU Interrupt System
Study Notes: Learning MCU from Scratch (4) D/A Conversion
DAC0832 is a monolithic DC output 8-bit digital/analog converter made using CMOS technology. As shown in the figure, it consists of four parts: an inverted T-type R-2R resistor network, an analog switch, an operational amplifier, and a reference voltage VREF. The analog value V0 output by the operational amplifier is:
[Microcontroller]
Study Notes: Learning MCU from Scratch (4) D/A Conversion
Realization of ultrasonic distance measurement and display based on 51 single chip microcomputer
1. Solution design: 1.1 Device selection: The hc-sr04 ultrasonic module has the characteristics of high detection distance accuracy, stable performance and small blind area, which can make the distance measurement more accurate and the improvement more reasonable. The system's single-chip microcomputer uses STC90C516R
[Microcontroller]
Design of frequency characteristic tester based on AT89C51 microcontroller and DDS device
1 Introduction Frequency characteristics are the response characteristics of a system (or component) to sinusoidal input signals of different frequencies. As shown in Figure 1, the system under test inputs a sinusoidal signal with amplitude Ar and angular frequency ω. If the system is linear, its steady-state output i
[Microcontroller]
Design of frequency characteristic tester based on AT89C51 microcontroller and DDS device
Why does the MCS-51 microcontroller need to interrupt the system expansion? How does the timer serve as an external interrupt source?
Why does the MCS-51 microcontroller need to use interrupt system expansion? Answer: Although MCS-51 has provided two external interrupt request input terminals INT0 and INT1, when there is still a large demand for external interrupt request sources, interrupt system expansion is required. When the timer is used as
[Microcontroller]
Latest Microcontroller Articles
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
    Since development under LINUX is still quite troublesome, is there a more convenient and simple development method under WINDOWS? The answer is yes. Of course, it is not a development tool like ADS, because it ...
  • Learn ARM development(15)
    When using GCC to develop ARM, you will definitely encounter compiler problems. For example, you will encounter various warnings and errors when compiling C code. For example, I encountered several warnings yesterday, so let's take a look at what these warnings are ...
  • Learn ARM development(16)
  • Learn ARM development(17)
  • Learn ARM development(18)
  • Embedded system debugging simulation tool
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号