Summary of knowledge about 51 pseudo instructions

Publisher:知识的海洋Latest update time:2021-03-16 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. DS --- reserved storage area command

Format: [label:] DS expression value

Its function is to define a storage area starting from a specified address for use by the source program.

The number of storage cells reserved for the storage area is determined by the value of the expression.

TMP: DS 1

Reserve 1 storage unit (byte) starting from the address labeled TEP.

2. BIT - define bit command

Format: Character Name BIT Bit Address

Its function is used to define the bit address for the character name.

SPK BIT P3.7

After definition, SPK is allowed to replace P3.7 in instructions.

3. USING instruction

The USING directive tells the assembler which set of 8051 working registers to use.

Format: USING expression (The value must be 0-3, the default value is 0.)

USING 0

Use group 0 of working registers.

4. SEGMENT instruction

The SEGMENT directive is used to declare a relocation segment and an optional relocation type.

Format: relocation segment name SEGMENT segment type [relocation type]

Among them, the "relocation segment name" is used to indicate the declared segment.

The "segment type" is used to specify the memory address space in which the declared segment will be located.

The available segment types are CODE, XDATA, DATA, IDATA, and BIT.

STACK_SEG SEGMENT IDATA

DATA_SEG SEGMENT DATA 

5. RSEG - Relocation segment selection instruction

The relocation segment selection instruction is RSEG, which is used to select a previously defined relocation segment as the current segment.

Format: RSEG segment name

The segment name must be a relocation segment that has been declared previously.

DATA_SEG SEGMENT DATA ; declare a relocated DATA segment

RSEG DATA_SEG ; select the previously declared relocated DATA segment as the current segment

6. Absolute segment selection instruction

CSEG - Absolute Code Segment

DSEG - Internal absolute data segment

XSEG---External absolute data segment

ISEG - Internal indirect addressing data segment

BSEG - absolute bit addressing data segment

Format:

CSEG [AT absolute address expression]

DSEG [AT absolute address expression]

XSEG [AT absolute address expression]

ISEG [AT absolute address expression]

BSEG [AT absolute address expression]

The brackets are optional and are used to specify the base address of the current absolute segment.

CSEG AT 0000H

AJMP MAIN

7. ORG directive

The ORG instruction is used to change the assembler's counter, thereby setting a new program starting address.

Format: ORG expression

The expression must be an absolute or simple relocation expression.

ORG 0000H

AJMP MAIN

Set the starting address of the MAIN program to 0000H.

8. END instruction

The END instruction is used to control the end of the assembly. There must be an END instruction at the end of each assembly program.

And the END instruction can only appear once.

9. EQU directive

The EQU directive is used to assign a value or register name to a specified symbolic name.

Format: symbol name EQU expression  

or symbol name EQU register name

The expression must be a simple relocation expression.

The character name assigned by the EQU instruction can be used as a data address, code address, bit address or

Use it directly as an immediate value.

LIMIT EQU 1200

COUNT EQU R5

10. DATA instruction

The DATA directive is used to assign an internal RAM address to the specified symbol name.

Format: symbol name DATA expression

The value of the numeric expression is between 0 and 255, and the expression must be a simple relocation expression.

PORT1 DATA 40H

11. DB instruction

The DB directive initializes code space with the bytes containing the value of the expression.

Format: [label:] DB expression table

The expression can contain symbols, strings, or expressions. Each item is separated by commas, and strings should be enclosed in quotation marks.

The label in brackets is optional. If used, the value of the label will be the address of the first byte in the expression table.

The DB instruction must be within the CODE section, otherwise an error will occur.

TABLE:

DB 0C0H, 0F9H, 0A4H

TABLE 1:

DB " WEINA "


Reference address:Summary of knowledge about 51 pseudo instructions

Previous article:Using 51 single chip microcomputer to realize simple radio frequency wireless identification device system
Next article:Design of Single Chip Microcomputer Control System for Stepping Motor

Recommended ReadingLatest update time:2024-11-16 10:34

51 MCU internal EEPROM read and write
#include reg52.h #include intrins.h //Define the type to facilitate code transplantation typedef unsigned char UINT8; typedef unsigned int  UINT16; typedef unsigned long UINT32; typedef char INT8; typedef int  INT16; typedef long INT32; static     UINT
[Microcontroller]
51 MCU internal EEPROM read and write
Sihui Fushi's net profit in the third quarter was 57.51 million yuan, up 107.22% year-on-year
On the evening of October 15, Sihui Fushi announced that it achieved revenue of 754 million yuan in the first three quarters, a year-on-year increase of 59.34%; net profit attributable to shareholders of the listed company was 141 million yuan, a year-on-year increase of 59.15%. Among them, revenue in the third quarte
[Mobile phone portable]
Sihui Fushi's net profit in the third quarter was 57.51 million yuan, up 107.22% year-on-year
51 MCU serial port expansion method
1 Introduction  In the process of studying the gas accumulation simulation test bench in the mining area, the author designed a master-slave multi-machine mining control system structure. The master-slave multi-machine control system is a more common structural form in real-time control systems. It has the advantages
[Microcontroller]
51 MCU serial port expansion method
Serial communication based on 51 single chip microcomputer (PC sends characters)
Serial communication Selected chip: AT89S52 Function function: See the following code. /******************************************************************* Function: The PC sends data to the microcontroller, sending 3 bytes of data each time (each byte is 8 bits). The content of each byte is one of the unsigned inte
[Microcontroller]
51 MCU Getting Started Tutorial (6) - External Interrupt
1. External interrupt 1.1 Interruptions The concept of interrupts has been mentioned in the previous blog. (Portal: 51 MCU Getting Started Tutorial (5) - Timer Interrupts) An interruption means that when some unexpected situation occurs during the operation of the computer and the host intervention is required, the
[Microcontroller]
51 MCU Getting Started Tutorial (6) - External Interrupt
Simulation debugging solution based on OC8051IP core implements download test in FPGA
In the early 1980s, Intel launched the MCS-51 microcontroller, and then Intel released the 8051 core to many semiconductor manufacturers in the form of patent transfer, resulting in the emergence of many products compatible with the MCS-51 system. These products have the same system structure as MCS-51 and use CMOS te
[Microcontroller]
Simulation debugging solution based on OC8051IP core implements download test in FPGA
Design of home security alarm system based on AT89C51 microcontroller and sensors
Home security alarm system The home security alarm function is an important function of the smart home system. Together with various sensors, function keys, detectors and actuators in the home, it constitutes the home security system and is the "brain" of the home security system. Alarm functions include fire preventi
[Microcontroller]
Design of home security alarm system based on AT89C51 microcontroller and sensors
C51 non-blocking time-delayed water lamp
#include reg52.h unsigned char counter=0; void delay()interrupt 1 using 1 { TL0|=0x00; TH0=0x4C; counter++; } main() { unsigned char i=1; TMOD=1; TR0=1; EA=1; ET0=1; TH0=0x4C; TL0=0x00; while(1) {  if(counter==10)  {   counter=0;   P1=~i;     i =1;   if(i==0)   i=1;  } }   } Adopt T0 mode 1 timing, 11.0592Mhz crystal
[Microcontroller]
C51 non-blocking time-delayed water lamp
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号