8051 Data Types 8 Bit and Directives 89C51 89C52

8051 Tutorial Data Types 8 Bit and Directives

Data type is a major building block of every program, without data type there is no meaning of embedded programming. So this way 8051 based microcontrollers like AT89C51, AT89C52, AT89S53, AT89S51, AT89S53 AT89S8252 data type is a common data type here in this free tutorial we will discuss about the most common used data type of 8051, MCS-51 microcontrollers.
When we talk about embedded programming or any other programming, without data type there is no mean of application. In 8051 microcontroller the basic data type is 8 bit. Entire architecture of 8051 is based on 8 bit data size called data type. So all basic registers of microcontroller 89C51 or any other variant microcontroller is 8 bit. Data moves between these register. One limitation of this 8 bit data type is, when there is need of larger data then the data is broken in further 8 bits and processed by programmer. Data type of 89S51, 89S52 is 8 bit also because these chips also come into the family of 8051.

8 bits starts from 00 to FFH or 0 to 255. While working on this data type there are many situation when programmer is challenged with the large size data. Then the condition comes how to process this large data and process further. Now comes to the strategy how to process this large data in 89C52 or any other variant. Solution is this data is broken down and processed by the CPU, central processing unit of 8051 microcontroller.

Microcontroller 8051 has only one 8-bits data type and the size of each register is also 8 bits. The job of the programmer is 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 type used by the 8051 can be positive or negative.
Since data type of 89C51, 89C52 is very low memory space only 8 bit, so the entire system works on 8 bit data through memory registers. Registers have the responsibility to transfer data from one memory location to another. Microcontroller is good for learning purpose now these days, its easy to understand the 8 bit which is small size to 16 bit large size.

Directives of 8051 Microcontrollers

We use various directives of 8051 microcontrollers, some important and crucial directives are given below and we will work and explain with extensive details.

DB [Define Byte] Directive
The most common directive is DB means Define Bit, the purpose of this directive is to define 8 bit numbers and data. Numbers like deciman, hex, binary or ASCII formats. One thing important to note using decimal its not mandatory to use D after decimal, but while using binary and hex then B and H is mandatory. When there is a need to define ASCII strings larger than numbers, in this case DB directive is used. It can also be used in all ASCII data presentation and definitions.

ORG [origin] Directive
ORG means origin, this is the indication of beginning of the address which is a number which comes after ORG may be hex or in decimal value. Using ORG means assembler will start compiling from the origin memory address 0000H location. This is the start location and address of program.

EQU [equate] Directive
When there is need to define constant without occupying storage memory location then this EQU directive is used.

END [END code] Directive
The most important the mandatory directive is END. As its name suggest there is END of source file. This directive is placed at the end of code file defines that there is no more code line, code is over. Means it is a last line of code. If you miss the END then program will not compile and generate error.

Author: admin