About the Tutorial
Assembling and Running an 8051 Program
Download 1.78 Mb. Pdf ko'rish
|
pdfcoffee.com embedded-systems-tutorial-pdf-free
- Bu sahifa navigatsiya:
- .obj file
- DB (Define Byte)
Assembling and Running an 8051 Program
Here we will discuss about the basic form of an assembly language. The steps to create, assemble, and run an assembly language program are as follows: First, we use an editor to type in a program similar to the above program. Editors like MS-DOS EDIT program that comes with all Microsoft operating systems can be used to create or edit a program. The Editor must be able to produce an ASCII file. The "asm" extension for the source file is used by an assembler in the next step. The "asm" source file contains the program code created in Step 1. It is fed to an 8051 assembler. The assembler then converts the assembly language instructions into machine code instructions and produces an .obj file (object file) and a .lst file (list file). It is also called as a source file, that's why some assemblers require that this file have the "src" extensions. The "lst" file is optional. It is very useful to the program because it lists all the opcodes and addresses as well as errors that the assemblers detected. Assemblers require a third step called linking. The link program takes one or more object files and produces an absolute object file with the extension "abs". Next, the "abs" file is fed to a program called "OH" (object to hex converter), which creates a file with the extension "hex" that is ready to burn in to the ROM. Embedded Systems 27 Data Type The 8051 microcontroller contains a single data type of 8-bits, and each register is also of 8-bits size. The programmer has to break down data larger than 8-bits (00 to FFH, or to 255 in decimal) so that it can be processed by the CPU. DB (Define Byte) The DB directive is the most widely used data directive in the assembler. It is used to define the 8-bit data. It can also be used to define decimal, binary, hex, or ASCII formats data. For decimal, the "D" after the decimal number is optional, but it is required for "B" (binary) and "Hl" (hexadecimal). To indicate ASCII, simply place the characters in quotation marks ('like this'). The assembler generates ASCII code for the numbers/characters automatically. The DB directive is the only directive that can be used to define ASCII strings larger than two characters; therefore, it should be used for all the ASCII data definitions. Some examples of DB are given below: ORG 500H DATA1: DB 28 ;DECIMAL (1C in hex) DATA2: DB 00110101B ;BINARY (35 in hex) DATA3: DB 39H ;HEX ORG 510H |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling