Microcontroller introductory program 1

Publisher:lambda21Latest update time:2015-12-28 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
;************************************************;

;Experiment name:       Flashing light experiment               ;
;Author:             Long Yi                   ;
;Version:             VER 1.0                 ;
;Description:  An introductory experiment for beginners to learn microcontroller programming       ;
;Modification:               None                    ;
;Programming language:        Assembly language                ;
;Programming date:       2010-04-12              ;

;************************************************;

method one:

       ORG  00H
START:  CLR  P0.0      ;P0.0 is set to 0, making the LED light up
      CALL  DELAY    ;Call the delay subroutine
      SETB  P0.0    ;P0.0 is set to 1, making the LED off
      CALL  DELAY    ;Call the delay subroutine
      JMP  START    ;Return to loop
DELAY:  MOV  R5,#20   ;Using a crystal oscillator of 12MHZ, the delay time of this delay subroutine is 0.2 seconds
D1:    MOV  R6,#20
D2:     MOV  R7,#248
      DJNZ  R7,$
      DJNZ  R6,D2
      DJNZ  R5,D1
      RET
       END

Method Two:

      ORG  00H
START:  CPL  P0.0    ; Invert bit P0.0 to make the LED turn on and off alternately
       CALL  DELAY    ; Call the delay subroutine
      JMP  START    ; Return to loop
DELAY:  MOV  R5,#20   ; Using a 12MHZ crystal oscillator, the delay time of this delay subroutine is 0.2 seconds
D1:    MOV  R6,#20
D2:     MOV  R7,#248
      DJNZ  R7,$
      DJNZ  R6,D2
      DJNZ  R5,D1
      RET
      END

Keywords:MCU Reference address:Microcontroller introductory program 1

Previous article:8051 MCU accurate delay program
Next article:Microcontroller introductory program 2

Recommended ReadingLatest update time:2024-11-16 14:54

51 MCU program for oled display temperature alarm
The actual picture of the upper and lower values ​​of the temperature alarm limit produced by the oled display is as follows: The microcontroller source program is as follows: #include #include "oled.h" #define uchar unsigned char #define uint unsigned int unsigned char set=0; unsigned char code table ="01234
[Microcontroller]
51 MCU program for oled display temperature alarm
Design of a SPWM variable frequency speed regulation system based on 8098 single chip microcomputer
At present, the research and development of high-performance AC speed regulation systems has attracted great attention from scholars from all over the world and has been studied more and more deeply. The selected microprocessor, power device and method of generating PWM wave are the direct factors affecting the perfor
[Power Management]
Design of a SPWM variable frequency speed regulation system based on 8098 single chip microcomputer
Discussion on preventing interference in the process channel of single chip computer system
1 Introduction Interference generally enters the microcontroller system in the form of randomly occurring pulses, mainly from the alternating magnetic field and electric field coupling system formed by sudden changes in loads on the power grid and in the system, forming a spike pulse potential or current superi
[Microcontroller]
Discussion on preventing interference in the process channel of single chip computer system
51 Microcontroller Study Notes (1): LED
When I first came into contact with the 51 microcontroller, I just followed the included study manual to learn it myself and took notes. 1. Light up the LED LED is a light-emitting diode, which has unidirectional conductivity and can emit light when a certain current passes through it. The LEDs on the microcontrolle
[Microcontroller]
Design and application of BSL programming tool for MSP430 microcontroller
introduction Texas Instruments ' MSP430 series microcontrollers are widely used in intelligent instruments, medical electronics, consumer electronics, etc. Most MSP430 series microcontrollers have non-volatile Flash memory. There are generally two ways for users to debug or update programs in Flash: JTAG and Bootstrap
[Microcontroller]
Design and application of BSL programming tool for MSP430 microcontroller
Design of LED dot matrix display control system based on PIC32 single chip microcomputer
Introduction: LED dot matrix display is a large display system that integrates microelectronics technology, computer technology, and information processing technology. It has become an ideal choice for many display media and outdoor work displays due to its bright colors, wide dynamic range, high brightness, long life
[Microcontroller]
Design of LED dot matrix display control system based on PIC32 single chip microcomputer
Two methods to set up UART for 32-bit microcontroller PIC32MX270F256B
Development IDE: MPLAB X 5.25 Download/DEBUG tool: MPLAB ICD 3/PICKIT 3 MCU:PIC32MX270F256B Compiler: XC32 V2.30 Crystal oscillator: external crystal oscillator 4M, system PLL multiplied to 48M as sys clock First, the library function method configures UART1 #include "UART.h" void UART1_Init()  {     // Associated p
[Microcontroller]
Application of μPSD32xx microcontroller in tax controller
Abstract: μPSD32xx is a SoC microcontroller integrating 51 cores and PSD (Programmable System Device). It has many functional components and is cost-effective. It is widely used in tax control equipment such as tax control cash registers, tax controllers and micro printers. middle. This article introduces the main feat
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • 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)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号