Programming and Program Execution

About programming and executions of program

In most modes of usage, including use as part of intelligent instruments, computers are involved in manipulating data. This requires data values to be input, processed and output according to a sequence of operations defined by the computer program.

Programming the microprocessor within an intelligent instrument is not normally the province of the instrument user; indeed, there is rarely any provision for the user to create or modify operating programs even if he/she wished to do so. There are several reasons for this. First, the signal processing needed within an intelligent instrument is usually well defined, and therefore it is more efficient for a manufacturer to produce this rather than to have each individual user produce near identical programs separately. Secondly, better program integrity and instrument operation are achieved if a standard program produced by the instrument manufacturer is used. Finally, use of a standard program allows it to be burnt into ROM, thereby protecting it from any failure of the instrument power supply. This also facilitates software maintenance and updates, by the mechanism of the manufacturer providing a new ROM which simply plugs into the slot previously occupied by the old ROM.

Whilst it is not normally therefore a task undertaken by the user of an intelligent instrument, some appreciation of microprocessor programming is useful background material. To illustrate the techniques involved in programming, consider a very simple program which reads in a value from a transducer, adds a pre-stored value to it to compensate for a bias in the transducer measurement, and outputs a corrected reading to a display device.

Let us assume that the addresses of the transducer and output display device are 0000 and 00C1 respectively, and that the required scaling value has already been stored in memory address 0100. The instructions below are formed from the instruction set for a Z80 microprocessor and make use of CPU registers A and B:

IN A, C0
IN B,100



This list of four instructions constitutes the computer program which is necessary to execute the required task. The CPU normally executes the instructions one at a time, starting at the top of the list and working downwards (though jump and branch instructions change this order). The first instruction (IN A, C0) reads in a value from the transducer at address C0 and places the value in CPU register A (often called the accumulator). The mechanics of the execution of this instruction consist of the CPU putting the required address C0 on the address bus and then putting a command on the control bus which causes the contents of the target address (C0) to be copied on to the data bus and subsequently transferred into the A register. The next instruction (IN B,100) reads in a value from address 100 (the pre-stored biasing value) and stores it in register B. The following instruction (ADD A, B) adds together the contents of registers A and B and stores the result in register A. Register A now contains the measurement read from the transducer but corrected for bias. The final instruction (OUT C1,A) transfers the contents of register A to the output device on address Cl.

More on Intelligent Instruments is a participant in the Amazon Service LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to