0% found this document useful (0 votes)
15 views3 pages

EEE 15EE63C U2 S12 Sy

Uploaded by

Abhishek Abhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

EEE 15EE63C U2 S12 Sy

Uploaded by

Abhishek Abhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

EMBEDDED SYSTEMS - 15EE63C 2020-21

UNIT 2

8051 Data Type and Directives

Session 12

8051 data type and directives


The 8051 microcontroller has only one data type. It is 8 bits, and the size of each
register is also 8 bits. It is the job of the programmer to break down data larger than 8
bits (00 to FFH, or 0 to 255 in decimal) to be processed by the CPU. The data types
used by the 8051 can be positive or negative.

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. When DB is used to define data, the numbers can be in decimal,
binary, hex, or ASCII formats. For decimal, the “D” after the decimal number is
optional, but using “B” (binary) and “H” (hexadecimal) for the others is required.
Regardless of which is used, the assembler will convert the numbers into hex. To
indicate ASCII, simply place the characters in quotation marks (‘like this’). The
assembler will assign the ASCII code for the numbers or 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 ASCII data definitions.
Following are some DB examples:

Diploma in Electrical and Electronics Engineering 1


EMBEDDED SYSTEMS - 15EE63C 2020-21

Assembler directives
The following are some more widely used directives of the 8051.

ORG (origin)
The ORG directive is used to indicate the beginning of the address. The number that
comes after ORG can be either in hex or in decimal. If the number is not followed by
H, it is decimal and the assembler will convert it to hex. Some assemblers use “.
ORG” (notice the dot) instead of “ORG” for the origin directive. Check your
assembler.

EQU (equate)
This is used to define a constant without occupying a memory location. The EQU
directive does not set aside storage for a data item but associates a constant value with
a data label so that when the label appears in the program, itp constant value will be
substituted for the label. The following uses EQU for the counter constant and then
the constant is used to load the R3 register.

When executing the instruction “MOV R3, #COUNT”, the register R3 will be loaded
with the value 25 (notice the # sign). What is the advantage of using EQU? Assume
that there is a constant (a fixed value) used in many different places in the program,
and the programmer wants to change its value throughout. By the use of EQU, the
programmer can change it once and the assembler will change all of its occurrences,
rather than search the entire program trying to find every occurrence.

END directive
Another important pseudocode is the END directive. This indicates to the assembler
the end of the source (asm) file. The END directive is the last line of an 8051
program, meaning that in the source code anything after the END directive is ignored
by the assembler. Some assemblers use “. END” (notice the dot) instead of “END”.

Diploma in Electrical and Electronics Engineering 2


EMBEDDED SYSTEMS - 15EE63C 2020-21

Reference Books:
1. The 8051 Microcontrollers-II edition-Kenneth j Ayala. Perram Publications.
2. Embedded system Design-Frank Vahid /Tony Givargis WSE. Wiley Publications.
3. 8051 Microcontroller-Hardware, Software and applications-V Udayashankara / M
S Mallikarjunaswamy - Tata McGraw Hill.

e- Resources:
1) YouTube videos on interfacing various peripherals and devices

2) www.microdigital.com

Model Question Bank

Cognitive Level: Remember


1. Explain the 8051 data types and directives.

XXXXXXXXXXXXXXXXX

Diploma in Electrical and Electronics Engineering 3

You might also like