The CPU can access the data in different ways by using addressing modes.Even though there are many high-levellanguages that are currently in demand, assembly programming language is popularly used in many applications.It can be used for direct hardware manipulations.
8051 Assembly Programming Code Efficiently WithIt is also used to write the 8051 programming code efficiently with less number of clock cycles by consuming less memory compared to the other high-level languages.Programming 8051 Programming in Assembly Language The assembly language is a fully hardware related programming language.The embedded designers must have sufficient knowledge on hardware of particular processor or controllers before writing the program. The assembly language is developed by mnemonics; therefore, users cannot understand it easily to modify the program. ![]() M icrocontrollers or processors can understand only binary language in the form of 0s or 1s; An assembler converts the assembly language to binary language, and then stores it in the microcontroller memory to perform the specific task. 8051 Assembly Programming Serial Communication AndMicrocontroller Architecuture The 8051 microcontroller is the CISC based Harvard architecture, and it has peripherals like 32 IO, timerscounters, serial communication and memories. ![]() The 8051 microcontroller consists of RAM and ROM memories to store instructions. Microcontroller Architecuture A Register is the main part in the processors and microcontrollers which is contained in the memory that provides a faster way of collecting and storing the data. The 8051 assembly language programming is based on the memory registers. If we want to manipulate data to a processor or controller by performing subtraction, addition, etc., we cannot do that directly in the memory, but it needs registers to process and to store the data. Microcontrollers contain several types of registers that can be classified according to their instructions or content that operate in them. Microcontroller Programs in Assembly Language The assembly language is made up of elements which all are used to write the program in sequential manner. Follow the given rules to write programming in assembly language. Rules of Assembly Language The assembly code must be written in upper case letters The labels must be followed by a colon (label:) All symbols and labels must begin with a letter All comments are typed in lower case The last line of the program must be the END directive The assembly language mnemonics are in the form of op-code, such as MOV, ADD, JMP, and so on, which are used to perform the operations. Op-code: The op-code is a single instruction that can be executed by the CPU. Operands: The operands are a single piece of data that can be operated by the op-code. Example, multiplication operation is performed by the operands that are multiplied by the operand. Syntax: MUL a, b; The Elements of an Assembly Language Programming: Assembler Directives Instruction Set Addressing Modes Assembler Directives: The assembling directives give the directions to the CPU. The 8051 microcontroller consists of various kinds of assembly directives to give the direction to the control unit. The most useful directives are 8051 programming, such as: ORG DB EQU END ORG ( origin): This directive indicates the start of the program. For example; ORG 0000h tells the compiler all subsequent code starting at address 0000h. Syntax: ORG 0000h DB ( define byte): The define byte is used to allow a string of bytes. For example, print the EDGEFX wherein each character is taken by the address and finally prints the string by the DB directly with double quotes. Syntax: ORG 0000h MOV a, 00h - - DBEDGEFX EQU (equivalent): The equivalent directive is used to equate address of the variable. Syntax: reg equ, 09h MOV reg, 2h END: The END directive is used to indicate the end of the program. Syntax: reg equ, 09h MOV reg, 2h END Addressing Modes: The way of accessing data is called addressing mode.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |