## Microprocessors Lecture 10

## Analogue to Digital Conversion

In addition to the role of the microprocessor in computing, a common usage is in equipment.

Analogue to Digital converters (ADC) and Digital to Analogue Converters (DAC) are required to convert between the various physical quantities (via transducers) and the TTL or CMOS-compatible signals of the microprocessor.

### Analogue to Digital

First, the analogue quantity to be measured is applied to a transducer which converts it into an analogue voltage (usually).

    			         transducer

    	analogue quantity  ---------------------> electrical value

The analogue quantity may be converted into an electrical signal as shown in the table:

    	temperature	->	thermocouple

    	weight		->	strain gauge

    	fluid flow	->	flow meter

    	velocity	->	tachograph

    	etc.

The outputs of the transducers above may be very small (microvolts) or very large (volts).

Therefore, before converting to a digital value using the ADC, the transducer output must be processed.

The output of the transducer may be:

- amplified / attenuated
- scaled (to a convenient range, by the addition of an offset)
- filtered (to reduce noise)

Usually, after processing, we arrive at a voltage between 0V and 5V. The maximum and minimum expected values of the signal fall within this 0 - 5 volt range.

ADCs are commonly available in a range of specifications from cheap, 8-bit converters (costing less than 2 pounds) to high precision, low-noise, fast converters costing many hundreds of pounds.

An 8-bit ADC takes the input range (0 - 5 V) which represents the minimum and maximum values of the signal and divides this up into 256 equal parts.

    	minimum value	= 0000 0000 B ($00)

    	maximum value	= 1111 1111 B ($FF)

ADCs usually have a built-in microprocessor interface:

- tri-state data outputs
- /CE input
- Start Conversion input (or write a bit in the Control Register)
- End conversion interrupt output

Alternatively, an 8-bit ADC may be interfaced to a PIA.

    	e.g.	CA1 input	= conversion done

    		CA2 output	= start conversion

### Revision material

Revision material on A-to-D converters and D-to-A converters can be found here. The way in which ADCs and DACs operate is not part of this course.

## Digital to Analogue

This is obviously the converse of the ADC operation. It is typically used so that a microprocessor system can drive a physical device.

    	e.g.	8-bit digital signal --------> analogue signal

At this stage, the analogue signal is normally in the range 0 to 5 volts.

To meet the required analogue signal level, the signal may be:

- amplified / attenuated
- scaled

in order to achieve the voltage range required for the transducer. The transducer will convert the voltage into:

    	frequency

    	motor speed

    	etc.

DACs are normally microprocessor-compatible but they may also be driven from the PIA (as in the ADC above).

## Memory mapped I/O and Ports

So far, all peripheral devices have been treated as memory-mapped I/O (input/output) devices. That is, these devices contain registers which appear at a certain address.

There is an alternative way to access peripheral devices which some manufacturers have adopted. This is through the use of I/O mapped ports. For example, the Z80 microprocessor and the 80x86 family of processors adopt this method.

In the Z80, for example, there are 256 ports with addresses Port0 to Port255.

These ports are accessed using the normal address and data buses but there is an additional control signal which distinguishes memory accesses from port accesses.

For the Z80, this signal is called /MREQ which is '0' for memory accesses and '1' for port accesses.

To activate /MREQ, there are special Z80 instructions called IN and OUT.

In this way, the Z80 has 64k bytes of addressing space and 256 bytes of I/O space in addition. If more than 256 bytes of I/O is required, then a Z80 system can use memory-mapped I/O as well.

| Back | Next |