Programming Techniques in microprocessor


To perform a particular task the programmer prepares a sequence of instructions, called a program. In the previous articles, we have discussed about the 8085 instruction set and addressing modes for this microprocessor. In this article we will discuss the art of programming, procedure for microprocessor program.


Programming is a art of direction to the microprocessor to follow the various steps to perform the desired task. One program can be written by various ways. Hence to perform a particular operation reader may write various programs. But in the effective programming the time required to execute the program should be less. It means number of bytes required for the desired operation should be less. So try to write programs, which use minimum bytes. For writing the program the reader may adopt the following procedure.

Procedure For writing programs

1. Define the task to be performed: First step in programming is to define the problem for which you are preparing the program, the different terms must be clearly mentioned such as
(a) Input to Programs:
In case of 8085, the following three possible conditions may arise
(i) Data is in general purpose register.
(ii) The data i in memory location.
(iii) Direct data is available
(b) Expected Operation:
The operations we are expecting inputs must be clearly defined. For example:
a AND b. or a + b + c, etc.
(c) Output of the Program: We have to specify where the output to be stored or to be displayed clearly.

2. Find the Feasible solution: To perform the operation decided in the definition, we have to plan to solve the problem by considering the following points:
(a) Method of inputting the data.
(b) Method to solve the problem with steps.
(c) Method of outputting the result.

3. Draw a flow chart for sequencing the various operations: Prepare the flow chart for above plan.

4. Write the program with instruction by the following flow chart: Each block of the flow chart can be replaced by the set of appropriate instructions.

5. Check the program to find any error and debug it: After writing the instruction we have to write the opcodes for the each instruction and feed in 8085 microprocessor carefully. And then execute the program which gives us the result. We have to check the result, if it is correct then the program correct, otherwise we have to check the program again to find out the error. The error must be removed for the correct results. This procedure is called as debugging.

Program Design Techniques

Flow Chart

Flow chart is art to represent the various actions and computations required to perform a particular task graphically. It is nothing but the block diagram which represents the structure of program. Flow charts simplify the large and complex tasks. Generally before writing the programs flow charts are drawn to have the detail knowledge of the large and complex tasks. Each block of flow chart can be directly converted into a set of instructions. The various blocks used in flow charts are as below.

For complex programs the following programming techniques are very useful:

Modular Programming

In this program design technique, the long programs are break-up into smaller programs. These modules can be designed, coded and debugged independently with least interaction with other modules. As such, it is easy to write, test and debug a module. In case any change is required to be made. It is made in a articular module and the entire program is not affected. On the other hand, the designer faces some basic problems in modular programming. It is how to break-up the given problem into modules. And how to integrate them when all modules are made ?

Top Down Approach

In this method, the complete task is divided into smaller tasks. One starts with writing the overall shell of the entire system using dummy calls to the lower level software modules. Once the outer shell i.e. the topmost level is specified, attention is given to the next lower level of programming. The concept of modular programming is inherent in top-down programming. The process goes on from the top to the bottom, till the total task is divided into smaller tasks. And each of them being small enough for comprehensive and precise programming. One of the major advantages of this method is that its testing and integrating occurs all along the way during programming and not at the end.

The top-down approach corresponds to the next book method of writing essays, in which the main topic is divided into subtopics. Again these subtopics are further subdivided into further subtopics till each of the subtopics becomes as small enough to be written in a paragraph. For example, a typical essay is divided into three parts: introduction, body and the conclusion. Each of these parts may be further divided in topics. Once the outline of a particular essay is prepared, the topics could easily be detailed out into paragraphs.

Structured programming

Structured programming is a technique to write a program which is associated with a set of rules and logics of program design. The main rules of program design are:

  1. Modular top-down approach with stepwise refinement ic. the program should be developed in a modular stepwise fashion and the details progressively put at lower and lower software modules as discussed earlier used make it difficult to follow the program flow
  2. The use of standard program structure. Only a few standard program structure are used.
  3. Unconditional jump, i.e. GO TO should be avoided. The unconditional jumps.

Any program can be written by using four program structures, i.e.

  • Sequential structure
  • Loop or Repetition structure
  • Subprogram structure
  • Conditional structure

1 thought on “Programming Techniques in microprocessor”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.