Latest News and Articles

Demystifying Microprocessors

Demystifying Microprocessors: Understanding the Basics

Microprocessors are essential components that handle Arithmetic, Logic, and Control operations in computers and various devices. They fetch, decode, and execute instructions from memory, using designated areas for each operation. Microprocessors are fabricated from multiple semiconductors and can process instructions rapidly, sending the results to output devices. They are integral to the functioning of electronic devices such as mobile phones, ovens, and gaming devices.

Key points to note:

Microprocessors

  • have registers for storing intermediate results, 
  • can move data internally,
  • utilize a “Program Counter” to store the address of the next instruction. 
  • process only binary digits (0 and 1) and are 
  • are categorized based on the number of addresses and data buses (4-bit, 8-bit, 16-bit, 32-bit, and 64-bit). 

8085 microprocessor:

One of the most extensively studied microprocessors is the Intel 8085, which is an 8-bit microprocessor featuring 40 pins and operating on a +5 V supply with a clock frequency of 3 MHz to 6MHz. The clock frequency directly influences the speed at which the microprocessor executes instructions, making it a critical parameter in determining processing efficiency.

Instruction sets vary across different microprocessors, defining the specific instructions that each microprocessor can execute. Skillful utilization of these instructions is crucial in strategically writing programs for a particular microprocessor, for ensuring optimal performance and functionality.

Types of registers:

While studying the 8085 microprocessor, understanding the different types of registers is essential:

Accumulator: The Accumulator, denoted as Register A, holds one operand in all two operand operations and also stores the final results of those operations.

Instruction Register: The Instruction Register holds the opcode, such as MVI or MOV, used in arithmetic and logic operations.

Temporary Register: The microprocessor uses the Temporary Register to hold data temporarily, and it cannot be accessed through instructions.

Flags: The microprocessor sets or resets status flags based on arithmetic operations. In the 8085 microprocessor, there are five flags that can be programmed.

General Purpose Registers: The 8085 microprocessor has several General Purpose Registers, including B, C, D, E, H, and L. These registers can store 8-bit data, and when used as pairs, such as D-E, B-C, and H-L, they can store 16-bit data.

Studying and understanding these different types of registers is crucial for effectively working with the 8085 microprocessor and writing efficient assembly language programs. Registers play a critical role in data manipulation and control during the execution of instructions, making them fundamental components of the microprocessor’s architecture.

8085 microprocessor

Types of instruction in 8085:

In the 8085 microprocessor, instructions are processed in three different formats based on the number of bytes they occupy:

One-byte instructions:

These instructions consist of a single-byte opcode and do not require additional data or address information. The operation is performed using operands specified in the opcode itself.

Eg:

  1. “MOV C, A” instructs the microprocessor to move the data from Register A to Register C
  2.  “ADD C” indicates that the data in Register C should be added to the data in the Accumulator. 

Two-byte instructions:

Two-byte instructions consist of a first-byte as an opcode and a second byte that specifies either data or an address. 

For instance, 

  1. “MVI C, 02” moves the data 02 into Register C, and 
  2. “ADI 04” adds the data 04 to the Accumulator. 

The opcode is one byte, and the second byte provides the required data or address.

Three-byte instructions: Three-byte instructions start with a first-byte opcode, followed by the second and third bytes, which represent address or data information. 

Eg:

  1. “LXI H, 2300H,” – This instruction loads the least significant bits “00” from data 2300 into Register L and the most significant bits “23” into Register H.

Understanding the formats of these instructions is crucial for programming the 8085 microprocessor effectively. 

Programming in 8085:

Let’s explore the basic steps involved in writing programs for the 8085 microprocessor.

Program for 8-bit addition:

Mnemonics

LDA 2050                                     

MOV B, A                               

LDA 2051                             

ADD B, A                                       

STA,2052                         

HLT

In this, the first instruction LDA 2050, is “load accumulator” which loads Accumulator with the data stored in the address 2050.

The second instruction, MOV B, A is for moving the contents of the Accumulator to register B.

The third instruction, LDA 2051, is used to load data from the address 2051 into the accumulator.

The next instruction is ADD B, A, which is used to add data of Accumulator and register B.

The next instruction is STA,2052 which helps in storing the results in the accumulator at address 2052.

The next instruction HLT is used to HALT the processing.

All these data should be input to the microprocessor, as corresponding numeral codes. 

Program for 16-bit addition as 8-bit with carry:

LHLD 4000H     

XCHG                

LHLD 4002H    

MOV A, E        

ADD L             

MOV L, A        

MOV A, D        

ADC H              

MOV H, A         

SHLD 4004H  

HLT                   

By the first instruction, i.e., LHLD, the first number from address 4000 is loaded into the HL pair

In the second step, the data in the HL pair is moved to the DE pair

In the third step, the second number is obtained from location 4002 is loaded to DE register pair

In the fourth step, the lower byte of the second number is moved to Accumulator.

In the next step, ADD L, it is added to Accumulator contents, and the results are stored in the accumulator.

In the next step, the results are moved to the L register from Accumulator.

In the next step, the higher byte of the first number is moved to Accumulator.

In the next instruction, content Accumulator, Higher byte of the second number, and Carry are added and the results are stored in Accumulator.

In the next instruction, the results are stored in locations 4004H and 4005H

Then the execution is stopped by HLT

Thus, by specifying the correct opcode and providing the necessary data or address information, programmers can harness the microprocessor’s capabilities to perform various operations and control tasks efficiently.

microprocessor's capabilities

Conclusion:

The 8085 microprocessor serves as a prototype that aids in comprehending the logic behind microprocessor operations in a straightforward manner. By studying the programming basics of the 8085, one can grasp the fundamental principles of assembly programming. 

Gaining insights into microprocessor architecture, instruction sets, and data manipulation opens up a world of possibilities for designing and optimizing various computational tasks.

Moreover, understanding assembly programming for the 8085 microprocessor provides valuable insights into low-level programming languages.

Share us

Share us