It then combines the 08H from the I register with the 70H from the external device and puts it into the program counter. The microprocessor program then switches to address 0870H and calls the telephone maintenance engineer.
When the microprocessor is interrupted, it stores information internally about what it was doing at the time of the interrupt so that when the interrupt is dealt with it can return to its previous task.
Interrupt priorities
Not all problems are treated equally, by us or by a microprocessor. It is unlikely that we would ever meet a sentence like: ‘I have forgotten to put any sugar in the coffee – I’ll go and get some – and I have also noticed that your house is on fire’.
As with all other microprocessor, Z80180 interrupts are partly generated by external circuits and some result from internal sources. The external ones can usually be blocked or ‘masked’ so we can tell the microprocessor to ignore them and all interrupts are placed in order of priority so multiple interrupts are prioritized.
In the case of the Z80180, an unrecognized instruction code is given top priority to prevent any random operation due to corruption during programming or transmission. This is called a TRAP.
After this comes a single non-maskable interrupt or NMI. This is used for critical situations that must interrupt any other program that is running.
Then follows three levels of external but preventable (maskable) interrupts. If we don’t want the program interrupted, all we have to do is to insert a ‘don’t interrupt’ code into the software. Some documentation refers to this type of interrupts as INT0, INT1, INT2, where the figure show the priority whereas as others use IRQ to stand for Interrupt ReQuest.
The remaining seven levels refer to internal interrupts generated by interrupt control registers and internal circuitry may need to interrupt the program for a moment in order to perform some other task. There will be a little more on interrupts in Chapter 17.
The power consumed by a microprocessor is mainly the result of internal activity so the more we make it do, the more power it uses. Changing the clock speed from 6 MHz to 33 MHz nearly doubles the power requirement.
We can add the ‘sleep’ instruction to the program and this has the effect of stopping the CPU clock and the data and address buses are disconnected. To wake the CPU up, we apply a signal to one of the interrupt inputs or activate the reset circuit by holding the voltage on the reset pin low.
We can also switch off the input/output circuitry on the microprocessor putting it into a ‘system stop’ mode. The Z8X180 family has three members: Z80180, Z8S180 and the Z8L180. The S version operates with a power supply of 5 volts and the L version supply is reduced to 3.3 volts.
The effect on the power consumption of switching between normal operation and ‘system stop’ mode is shown in Table 8.1.
Table 8.1
Normal operation | ‘System Stop’ mode | |
---|---|---|
Z80180 | 100 mW | 25 mW |
Z8S180 | 90 mW | 15 mW |
Z8L180 | 60 mW | 6 mW |
Bus state controller
In a system, the microprocessor is connected to all the surrounding circuits by a series of connections called the system bus. Sometimes these devices may wish to send data along the system bus and the bus state controller ensures that we don’t have multiple devices trying to send data along the same connections at the same time.
Direct memory access (DMA) controller
As the name may suggest, this circuit provides direct access to the memory without using the central processing unit. The DMA can provide high-speed transfer of data from one part of the memory to another. It can also pass data directly to and from the memory and external devices. This provides significant improvements in operating speed of the whole system.
Dynamic memory refresh
Do you remember that the problem with dynamic memories was the constant refreshing that was needed to keep the RAM data intact? Well, an internal register is used to handle the refreshing process for us. It fits in the job between instructions and does not slow the microprocessor in any way and neither the programmer nor the user is aware that it is continuing in the background. Some microprocessors do not have this register and an external chip is added to the system to perform the refreshing. Either way, it has no obvious effect on the operation of the system.
Wait states
To make it easier to send information to relatively slow external devices the microprocessor is able to insert ‘wait states’ which can insert more time into its bus cycle timing. They can be programmed in by the software being used or internally by a wait state generator.
Serial inputs and outputs
To move data in or out in serial mode in which the stream of data is applied to a single input connection one bit after another we are given a choice of two options.
First is a clocked serial input/output (CSIO). This is a simple high-speed data connection to another microprocessor that is capable of sending and receiving data, though not at the same time. The transmission is synchronized to the microprocessor clock.
There are also two asynchronous serial communications interfaces (ASCI). These provide two other data connections that can be programmed to select the required speed of transmission and provide two-way transmission.
In the beginning
After the power supplies are first switched on, there is a short delay built in to allow the voltages to settle and for the clock to start. This delay is produced by a circuit similar to that shown in Figure 8.9.
Figure 8.9 The ON/OFF switch
The circuit uses a capacitor. A capacitor is a device designed to store electricity rather like a bucket can be filled with water.
When the micro system is switched off, the capacitor has a short circuit across it and the current that is flowing through the resistor bypasses the capacitor hence there is no electricity stored and hence there is no voltage across it. The same effect is achieved by holding the reset pin at zero volts for a time equivalent to at least six clock cycles.
Then we switch on and the current flowing through the resistor now accumulates in the capacitor and the voltage starts to increase. The voltage grows in the way shown in Figure 8.10 and after a short period of time, less than a microsecond, the voltage reaches two volts, which is enough to switch the microprocessor on.
The clock starts ticking and the microprocessor follows a sequence of steps called a start-up microprogram that was built into the microprocessor by the manufacturer.
It performs some internal tests and similar housekeeping jobs and then puts an address on the address bus. This address is, reasonably enough, called the startup address and is again fixed by the manufacturer. In the Z80180 the startup address happens to be 0000H and so this part of the memory map must contain some ROM to hold the start-up program.
Figure 8.10 Generating a short delay when switching on
Back at Figure 6.22 we saw a typical memory map in which the startup program was held in the high end of the memory. The Z80180 would require a quite different map and this indicates yet another incompatibility between microprocessors.
The first instruction