ORG 0030H

Publisher:anluranLatest update time:2020-10-09 Source: eefocusKeywords:ORG Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

ORG is a pseudo-instruction, telling the compiler to store the program from 0000 in ROM, but AJMP MAIN is an unconditional jump instruction, that is, after the microcontroller is powered on, it will first start executing the program from 0000, but AJMP will directly jump the program to the storage area pointed to by the MAIN label to start fetching instructions and executing them. Generally, the MAIN label is placed after the statement ORG 0030, that is, the main program is stored from the address 0030;


This is because there are several interrupt sources inside the microcontroller. The default entry for internal interrupts (including several timer interrupts and external interrupts) is between 0000-0030. Each interrupt takes up about two or four bytes, I can't remember clearly. Once these internal interrupts occur, the pointer must immediately point to between 0004-0030. If your program has statements placed in this address, the program will definitely run away!!!


Therefore, in the design of the 8051 MCU, 0004-0030 has been allocated for internal use. Therefore, your program can only be stored from any storage area after 0030. AJMP MAIN is to know which address in the ROM to start fetching instructions from when the MCU is powered on.


If you use interrupts, you must also write AJMP at the address 0004--0030 that has been defined as the interrupt entry, so that you can jump to the corresponding interrupt program you wrote.

Keywords:ORG Reference address:ORG 0030H

Previous article:STC15W4K48S4's direct USB-ISP function! The most convenient download for 51 MCU
Next article:Usage of R8051XC2 Timer 2

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号