Skip to main content

8051 Microcontroller Assembly Language Programming


 In the previous 8051 Microcontroller Tutorial, we have seen about the 8051 Microcontroller Instruction Set and Addressing Modes. In this tutorial, we will take a look at the 8051 Microcontroller Assembly Language Programming, the structure of 8051 Assembly Language, example programs, etc.

Before going into the details of the 8051 Microcontroller Assembly Language and Programming, let us get a brief idea about Programming Language in general (specific to Microcontrollers) and also types of Programming Languages.

What is a Programming Language?

Programming in the sense of Microcontrollers (or any computer) means writing a sequence of instructions that are executed by the processor in a particular order to perform a predefined task. Programming also involves debugging and troubleshooting of instructions and instruction sequence to make sure that the desired task is performed.

Like any language, Programming Languages have certain words, grammar and rules. There are three types or levels of Programming Languages for 8051 Microcontroller. These levels are based on how closely the statements in the language resemble the operations or tasks performed by the Microcontroller.


The three levels of Programming Languages are:

  • Machine Language
  • Assembly Language
  • goog_981911429High-level Language

Machine language

In Machine language or Machine Code, the instructions are written in binary bit patterns i.e. combination of binary digits 1 and 0, which are stored as HIGH and LOW Voltage Levels. This is the lowest level of programming languages and is the language that a Microcontroller or Microprocessor actually understands.


Assembly Language

The next level of Programming Language is the Assembly Language. Since Machine Language or Code involves all the instructions in 1’s and 0’s, it is very difficult for humans to program using it.


Assembly Language is a pseudo-English representation of the Machine Language. The 8051 Microcontroller Assembly Language is a combination of English like words called Mnemonics and Hexadecimal codes.


It is also a low level language and requires extensive understanding of the architecture of the Microcontroller.


High-level Language

The name High-level language means that you need not worry about the architecture or other internal details of a microcontroller and they use words and statements that are easily understood by humans.


Few examples of High-level Languages are BASIC, C Pascal, C++ and Java. A program called Compiler will convert the Programs written in High-level languages to Machine Code.


Why Assembly Language?

Although High-level languages are easy to work with, the following reasons point out the advantage of Assembly Language

  • The Programs written in Assembly gets executed faster and they occupy less memory.
  • With the help of Assembly Language, you can directly exploit all the features of a Microcontroller.
  • Using Assembly Language, you can have direct and accurate control of all the Microcontroller’s resources like I/O Ports, RAM, SFRs, etc.
  • Compared to High-level Languages, Assembly Language has less rules and restrictions.



Comments

Popular posts from this blog

Ferrules and Cross Ferruling

 Ferrules are identification labels provided for every wire terminations in an instrument, equipment, or electrical/instrumentation control panels. These tube-shaped sleeves can be inserted easily on each individual wire in a multi-core cable. In earlier days fixed digits/letters are used as ferrules, but now Instrumentation engineers/technicians prints out desired ferrules by using a ferrule printing machine. Typical Ferrule The numbers/ letters on the ferrules will be given as per the approved electrical hook up or loop diagrams. This helps technicians to easily identify a particular loop/wiring from a series of terminal blocks and to troubleshoot the desired terminal connection. Separate numbers on the ferrules distinguish the positive and negative polarities of wires, thus ensure the polarity protection of the instrument. Cross Ferruling  As a wire is connected on its both ends, it is quite useful to use a cross reference method for wire identification. Unlike normal ferru...

What is a Torbar? – Averaging Pitot Tubes

 The Torbar is employed for flow measurement of liquids, gases, or steam in circular, square, or rectangular section ducts for large flow rates. The Torbar is an insertion type multi-port self-averaging primary sensor for flow measurement. Torbar TORBAR is a set of Pitot tubes mounted on a bar across the pipeline with no moving parts. An averaging Pitot tube is a technology, while TORBAR is a manufacturing brand name. There are several brands available in the market with VERABAR, ANNUBAR, etc. Averaging Pitot Tube Principle Purpose Averaging Pitot tube can be employed when the average velocity of the flow profile, rather than the velocity in a specific point in the cross-section is desired. Averaging Pitot Tubes Principle It measures the differential pressure between the static pressure tap and the tap of full pressure of a stream. Thus such magnitude of differential pressure is directly proportional to the square of the flow rate. Working The TORBAR is designed in such a way that ...

Dissolved Oxygen Analyzer Working Principle

 What is dissolved oxygen ? Dissolved oxygen refers to oxygen dissolved in water. Its concentration is expressed as the amount of oxygen per unit volume and the unit is mg/L. Biologically, oxygen is an essential element for respiration of underwater life and also acts as a chemical oxidizer. The solubility of oxygen in water is affected by water temperature, salinity, barometric pressure, etc. and decreases as water temperature rises. Measurement of dissolved oxygen by the membrane electrode method The membrane electrode method measures a diffusion current or reduction current generated by the concentration of dissolved oxygen or partial pressure of oxygen to obtain the concentration of dissolved oxygen. This method is not affected by the pH value of water being measured, oxidation and reduction substances, color, turbidity, etc. and the measurement method offers good reproducibility. When a sensor is inserted into water, an air layer forms on the membrane (Teflon membrane). The ox...