Assembler Directives of 8051 – 8051 Assembly Language Programming – 8051 Microcontroller

Assembler Directives of 8051 – 8051 Assembly Language Programming – 8051 Microcontroller


Do subscribe to Ekeeda Channel and press bell icon to get updates about latest engineering HSC and IIT JEE main and advanced videos Hello friends in this video we will study about the assembler directives present in the 8051 micro controller we will study what are these assembler directive what are their users what functions are performed by these assembler directives in the 8051 micro controller so let’s start with a topic you so let us first understand that what our assembler directives so assembler directives they are the statements which are going to direct the assembler that what it has to in that it has to do something ok so like in 8:05 fun we are having instructions ok and these instructions are written in the program so by these what the instructions do they are going to perform some specific operation but the assembler directives they are different from the instructions they are not executed or they are not converted into the machine codes they are just given directly to the assembler okay so assembler is going to do some operation when this assembler directive is written as a statement in the program okay so the speciality of these are assembler directive is that they are not being converted into the machine codes they are directly given to the assembler they are effective only during the assembly of a program and they do not generate any code so the assembler directives they are just like some statements or some instructions but the difference is that instructions are converted into machine code but the similar directives they do not generate any codes and they are effective only during the assembly of the program means they are given to the assembler and then the assembler is going to perform the operation related with that director so let’s see that what the are the assembler directives present in the 8:05 one microcontroller the first assembler directive present in 8:05 one is o-r-g its full-form is originated this assembler directive is used to set the beginning address of the program that from where the program is to be written in the memory of the a zero five one so to set the beginning address we will use our cheap you now after this orgy we will write a number okay and this number can be your hexadecimal number or a decimal number now if this number is written in decimal then the assembler is going to convert that number into Exodus you so what this originated or OMG assembler directive does it allows to set the beginning address and this address will be written after it in the form of a number so it’s format will be O of G and then we will have the expression example is or G 0 0 H so this number is in hexadecimal and the program will start at the location 0 ok so from 0 0 the program will be written in the memory of a 0 5 1 so this is the first assembler directive second assembler directive is defined by dB now this directive it defines the byte variable okay Macbeth oh that bite what is the format of that byte variable weather is this in a decimal it isn’t exactly similar it is in binary or this in a sky format x guy code then that will be defined by this assembler directive you so this that it defines the bite type variable that the bite is in which format when the DB is used to define the data the numbers can be in decimal the format of the number can be in decimal binary hex for a Skye format now when the number it is in binary format then we have to define via we have to write B after the number if when we are writing B it means that this number is thisn binary so when the number is in binary whenever B is used after the number now if the number it is in decimal it is in binary hex or s Chi then in whatever format it is present the assembler is always going to convert it again the hexadecimal format so assembler always converted the number a or bite to hex decimal format so the similar that assembler is going to always convert the number into the exodus format now if we are indicating the numbers in the S key format okay so if number is in a square format the characters they are placed in the quotation marks okay for binary we are I think B for a sky characters we are writing the number in the quotation marks so this DB directive it is the only directive which allows the 8:05 one to use the string characters to define those string characters or the SK characters in the form of two bytes okay now let’s see the format of this assembler directive that how this directive is written in the assembly language program so first if we are writing B B and then 24 we will write D B and then the number will be there so DB and 24 is written it means that it is in decimal then if B B 0 1 1 0 1 1 1 1 and then B is written after it then it means that it is in binary if DB and in quotation marks the number is written then it means that it is in a sky format if we are writing DB and then 10 and H is written then it means that it is in hexadecimal notation so in this way we can define the byte the character and in different formats in different data types these are the data types and with the help of their format we can know that in which representation the number is present ok now next assembler directive is e q you that is equate this assembler directive is used to define some value or symbol means we are giving some value to a particular number or to a particular string okay to a particular symbol you so this assembler data was used to give a name to some value or symbol in the program value means like we are having 22 by 7 we know that this is equal to pi so in the program we will whenever we are writing PI then we will use this value 22 by 7 so we are giving a name to some value or symbol in the program okay suppose that instead of Pi 5 written this symbol and whenever we are using this symbol in the program it means that it is equal to 22 by 7 so I am giving this value some name or some symbol and we are using this symbol again and again in the program so it is used to define a constant without occupying a memory location this will reduce the occupation or the storage in the memory location ok now its format is named equ and then initial value let us take an example suppose that we have written fact then equ and then for 0 for H it means that we have given this fact of value 0 for okay now whenever in the program they are using fact it means the assembler is going to replace this with the value 0 4 okay so this is the use of the assembler directive equate next assembler directive is end this directive is placed at the end of the program so to terminate the program or to indicate that this is this is the place where the probe has a stop we are going to write the statement end at the last two as the last statement of the program so it is placed at the end of the source and it acts as the last statement so we can say that this directive terminate the entire program after that if any instruction is written then that instruction will not be executed by the 8:05 fun assembler okay and its format is just we are going to write e n D as the last statement of the program now next assembler directive is DS it’s full form is data sig and when this directive is written then it is going to declare or 24 byte of memory location or 24 bite of stack in the data segment okay so declare 24 byte stack in data segment that starts ad internal Ram location 0 8h so it is going to automatically defined a memory location as the 24 byte of the data segment okay and this 24 byte data segment we’ll start from the memory location 0 8 H ok so des needs data segment and its format is just we are going to write D s in the program next a similar directive is public and X term suppose that in a program we are defining our variable and this variable is to be using some other file also so we will define that variable as public and that variable can be used in any of the files in the 8:05 fun so public is used to define a variable for all the files extern means some that if some variable is defined in another file and that variable is being used in some other file ok suppose that in file 1 we have defined a variable a and in file number two we are using that variable a so X term will be used to export that variable from that file and public means suppose that we have defined a variable a and this variable is to be used in v 1 also file 2 also v 3 also so well publicly define that variables so public declares the variable you so public declares the variable which is defined in a specific file and that can be used in other source file okay we have defined that variable in one file and now we are using that variable in other files also X term declares the variable you so it declares the variable that I used in the present file but are defined in some other source file okay so that is the difference between public and extra both are used for defining the variables in the source file just the difference is that public is going to define the variable in specific file and that can be used in other files also but here it is defining some the it is defined in the present the file but it is used in some other source file ok we are using it in the present file but it is defined in some other specific file okay so these are the six assembler directives which are used in the 8:05 phone microcontroller so RG equate and D s DB and public and extern okay so these are similar directives they do not generate any machine code and they are just directing the assembler to do some tasks or to do something ok so I hope that this topic is now clear to you thank you

11 thoughts to “Assembler Directives of 8051 – 8051 Assembly Language Programming – 8051 Microcontroller”

  1. Hello Friends,

    Watch Complete Video Series of Subject Microcontroller and Its Applications only on Ekeeda Application.

    Use Coupon Code "NEWUSER" and access any one Subject free for 3 days!

    Download Ekeeda Application and take advantage of this offer.

    Android:- https://play.google.com/store/apps/details?id=student.ekeeda.com.ekeeda_student&hl=en

    iOS:- https://itunes.apple.com/tt/app/ekeeda/id1442131224

  2. Thanks for sharing, it is a wonderful and easy way to learn about 8051 but only I thing I bad is adds for every 2 to 3 mnts

Leave a Reply

Your email address will not be published. Required fields are marked *