Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 7 Features and Interfacing of Programmable Devices for 8085 based systems.

Similar presentations


Presentation on theme: "Chapter 7 Features and Interfacing of Programmable Devices for 8085 based systems."— Presentation transcript:

1 Chapter 7 Features and Interfacing of Programmable Devices for 8085 based systems

2 Intel 8255 Programmable Peripheral interface
Intel 8085 microprocessor can transfer data between external devices such as input devices and output devices through ports. Normally a register can act as an I/O port. But having a separate register and configuring them for input and output operation becomes difficult and tedious. So, Intel has designed a separate IC 8255 with the objective of interfacing input and output devices with Intel microprocessors. The 8255 is used on several of range of I/O cards that plug into an available slot in Personal Computer.

3 Introduction The 8255 Programmable Peripheral Interface (PPI) is a very popular and versatile input / output chip that can be easily programmed to function in several different configurations. This chip can do both digital input and output (DIO) from the processor in a preprogrammed manner. The common application of 8255 with 8085 include turning on a switch, to control movement by use of motors, to detect position etc.

4 Features of 8255 Each 8255 has three 8-bit TTL- compatible registers or ports which will allow the programmers to control digital outputs of up to 24 bits or to read 24 bit inputs, or control a mixture of both input and output. The common features of Intel 8255 IC are as followed. Three 8-bit ports named as Port A, Port B, Port C connected to output pins. Port C has been divided to two groups of 4 bits each as Port C upper (PCU) and Port C lower (PCL). Each of them can be programmed independently for Input and output operation.

5 Features of 8255 contd.. All the ports can be programmed for simple I/O or Handshake I/O for the data transfer in I/O modes. Each Port C bit can be set/reset individually in BSR mode. Port A bits and Port C Upper bits are grouped as Group A (GA). Port B bits and Port C Lower bits are grouped and called as Group B (GB).

6 Block diagram of INTEL 8255

7 Block Diagram Description
The block diagram of 8255 has three basic registers of 8 bits each and are called as Port A, Port B and Port C. The port A and upper 4 bits of Port C are grouped and called as Group A. Similarly, Port B and lower 4 bits of Port C are grouped as Group B. In addition to three registers A, B and C, there is another register called control register. The contents written into the control register decides the operating modes of the three parallel ports.

8 Block Diagram Description contd..
In order to identify the four registers, 8255 uses two address lines A0 and A1. These lines get their signals from the 8085 processor address bus. The identification of the registers based on A0 and A1 is

9 Pin details of IC 8255

10 Pin diagram Description
The three ports of 8255 needs 8 lines each and so 24 pins are allotted for ports and these lines are connected to external Input or output devices. D0-D7 are the lines required for interfacing 8255 with the processor. These data lines are connected to the data bus of the processor. Eight lines or pins are remaining. Out of these 8 lines, 2 lines A0 and A1 are allotted for selecting one of the 4 registers available in 255.

11 Pin diagram Description contd..
The control signals for reading and writing to these registers re the active low is RD and WR signals. These signals are obtained from the processor control signals. The entire chip is selected by activating the active low chip select CS signal. This signal is in general obtained from the decoder which decodes the address lines and identifies the 8255 addressing. A common reset signal can be applied to reset 8255 and can be same as RESET OUT of 8085 processor.

12 Operating modes and control words of 8255
The functional operation of each port is programmed by the software in other words by the programmer. The programming of 8255 is done by writing a control word to the control register of 8255. The control word contains information such as “mode”, “bit set”, “bit reset”, etc., that initializes the functional configuration of the 8255.

13 Operating modes in 8255

14 Operating mode- description
There are two different configurations of 8255 namely input /output mode (I/O mode) and Bit set reset mode (BSR mode). Again in I/O mode, there are three modes for the ports. The control word format for the I/O configuration and BSR configuration Group A and Group B accept “commands” from the Read/Write Control logic, receive “control words” from the internal data bus and issue proper commands to its associated ports.

15 Operating mode- description contd..
Before using the chip, it has to be programmed to configure its operation. The configuration is done by the control word and it tells the 8255 whether ports are input or output and even tell whether ports are bi-directional or strobed.

16 I/O Control word Format

17 Control word - Description
The MSB D7 bit is set to 1 to indicate that Input and output mode of the ports are configured in the I/O control word. Bits D6 and D5 are used select the operating modes of the group A. There are three basic modes of operation for group A and can be selected by the control word.

18 Description of MODE select bit
Mode 0 - Basic Input/Output (Bits D6 and D5 are 0 and 0) - Ports A and B operate as either inputs or outputs and Port C higher order 4 bits can be operated as inputs or outputs. This mode uses simple I/O operation and no interrupts are used. The outputs written to the ports are latched and available at any time. Inputs available at the port pins are buffered through port latches.

19 Description of MODE select bit contd..
Mode 1 - Strobed or Handshake Input/Output (Bits D5 and D6 are 0 and 1)- Port A is configured in mode1 but Port C is used for handshaking and control of data transfer in Port A. Input and output data are latched Mode 2 - Bi-directional Bus (Bits D5 and D6 are 1 and X, don’t care) Port A is bidirectional (both input and output) and Port C is used for handshaking. Port B cannot be programmed to have this mode.

20 Control word – Description contd..
Bit D4 is used to select the direction of data flow in the Port A bits. That is it programs whether the port A bits are input pins or output pins. For making Port A bits as input pins, bit D4 of the control word is set to 1 and it is set to 0 to program Port A as output port. Bit D3 is used to input and output operation of Port C upper four bits. For making Port C upper bits as input pins, bit D3 of the control word is set to 1 and it is set to 0 to program the same as output port.

21 Control word – Description contd..
Bit D2 of the control word is used to select the mode for the group B. As discussed earlier, only two operating modes are possible for Group B i.e., Mode 0 and Mode1. Mode 0 - Basic Input/Output for Group B is selected if bit D2 is programmed as 0. This mode uses simple I/O operation and no interrupts are used as discussed earlier. Mode 1 - Strobed or Handshake Input/Output is selected for group B if D2 bit is set to 1. Port B is configured in mode1 but Port C lower bits are used for handshaking and control of data transfer.

22 Control word – Description contd..
Bit D1 is used to select the data direction for Port B pins. If it is 0, then Port B pins are configured as output pins and if it is 1, then the port B pins are configured as input pins. Bit D0 is used to select the data direction for Port C lower pins. If it is 0, then the Port pins are configured as output pins and if it is 1, then the port C lower order pins are configured as input pins.

23 BSR Mode control word format

24 Description – BSR Mode control word
In Bit Set Rest (BSR) mode, any of the eight bits of Port C can be Set or Reset using a single control word written to the control register. This feature reduces software requirements in control-based applications and using mode 1 and 2 of other ports. When Port C is being used as status/control for Port A or B, these bits can be set or reset by using the Bit Set/Reset operation just as if they were output ports.

25 I/O mode 1 operation This Mode 1 configuration of 8255 provides a means for transferring I/O data to or from a specified port in conjunction with strobes or “hand shaking” signals. In mode 1, port A and port B use the lines on port C to generate or accept these “hand shaking” signals. In mode 1 the ports are divided into two Groups - Group A and Group B. Each group contains one 8-bit port and one 4-bit control/data port.

26 I/O mode 1 operation contd..
The 8-bit data port is either Port A or Port B and can be either input or output. Both inputs and outputs are latched. The 4-bit control port is either Port C upper or Port C lower bits and can be used for control and status of the 8-bit port.

27 Control and Handshake signal for Input operation in Mode1

28 Input Control and Operation
The operation of handshake signals for the input operation in 8255 is explained with the above figure. The sequence of operations for the data input operation from an input device to microprocessor through 8255 is listed as followed.

29 Input Control and Operation contd..
Step 1 The input device places data in the data lines i.e., the Port A or Port B lines. This is communicated to 8255 by making STB (Strobe Input) low. STB is an active low signal applied to PC4 or PC2. Step 2 8255 acknowledges the receipt of the data to the input by making IBF (Input Buffer Full) high. This also indicates that the data has been latched into the input port.

30 Input Control and Operation contd..
Step 3 8255 then makes INTR line (Interrupt Request) high and applies an interrupt to the processor. This signal is applied with a condition that INTE (Interrupt Enable) must be high. INTE for Port A is controlled by bit set/reset of PC4 and INTE for port B is controlled by bit set/reset of PC2. PC2 and PC4 can be controlled using BSR mode.

31 Input Control and Operation contd..
Step 4 The processor in the interrupt service routine reads the data from the corresponding input port. Reading from the port is done by selecting the 8255 port and applying RD active low signal. Step 5 During Read operation the RD signal low. When RD signal goes low, INTR signal is reset. IBF is reset by the rising edge of the RD input.

32 Input Control and Operation contd..
The entire procedure explained above for mode1 allows an input device to request service from the CPU by simply sending its data into the port and giving STB signal.

33 Control and Handshake signal for Output operation in Mode1

34 Output Operation and Control
The control signals or handshake signals used for the output in mode 1 of 8255 The handshake signals used are OBF, ACK and INTR. The sequence of operations taking place for data output from the processor to an output device is listed below.

35 Output Operation and Control contd..
Step 1 The processor will initiate the data transmission by writing the data to be transmitted to the output device to the corresponding port of 8255. This is done by processor by sending the port address to 8255 and data on the data lines and then giving the active low WR signal. Step 2 To transfer the data to the output device, 8255 will make OBF (Output Buffer Full- active low signal) “low” to indicate that the CPU has written data to be given to the specified port. The OBF flip flop will be set by the rising edge of the WR input.

36 Output Operation and Control contd..
Step 3 The data available on the output port pins are then read by the output device. After receiving data from the port pins, the output device acknowledges the same by making ACK low. ACK is an active low input signal to 8255 from the peripheral device indicating that it is accepting data. OBF output signal of 8255 is reset by ACK input being low.

37 Output Operation and Control contd..
Step 4 8255 will now inform to the processor that data has been transferred to the output device by making INTR (Interrupt Request) line high. A “high” on this output can be used to interrupt the CPU when an output device has accepted data transmitted by the CPU. INTR is set when ACK is a “one”, OBF is a “one” and INTE is a “one”.

38 Output Operation and Control contd..
Step 5 In the interrupt Service routine, the processor writes the next data to be transmitted to the output device to the output port of 8255. INTR signal is reset by the falling edge of WR.

39 I/O mode 2 operation In mode 2, data is transmitted and received via port A pins (bi-directional bus I/O) with handshaking capability. Only Port A can be configured in Mode 2 and is used as a bi-directional port while port C is used for handshaking signals. Interrupt generation and enable/disable functions are also available through Port C pins. Meanwhile, Port B can be configured to be in Mode 0 or 1 and Port B cannot be configured for mode2.

40 I/O mode 2 operation contd..
Both inputs and outputs are latched. The 5-bit control port (Port C) is used for control and status for the 8-bit, bi-directional bus port (Port A). The basic control signal transmission and operation of the data transfer in mode 2

41 Control of Port A data transfer in Mode 2

42 Control Signal and operation of Bi-Directional Bus I/O- Mode 2 contd..
The input and output operation of 8255 in mode is similar to the operation in mode 1 except that the Port A is bidirectional port. The data is transmitted and received through the Port A lines. For the output operation, as in mode 1, the data transfer is initiated by the processor by making the active low signal OBF low.

43 Control Signal and operation of Bi-Directional Bus I/O- Mode 2 contd..
This indicates that the processor has written data to output port. The output device after reading the data will give an acknowledgement by making ACK (Acknowledge signal – Active low signal) low. The processor will then be interrupted by 8255 to indicate that the output data port is ready for next data output or transmission. Here, the interrupt can be applied to processor only if INTE 1 flip flop associated with OBF and controlled by PC4 is set by the processor earlier

44 Control Signal and operation of Bi-Directional Bus I/O- Mode 2 contd..
The input operation is also similar to mode 1 operation. Here the data transfer is initiated by the input device by placing the data on the port pins. Then an active low control signal STB is given to 8255 by the input device for taking data. 8255 will now latch up the data to its port and then give an active high signal IBF to the input device.

45 Control Signal and operation of Bi-Directional Bus I/O- Mode 2 contd..
8255 will then issue an interrupt signal to the processor to indicate that a data is readily available for read operation. Here, the interrupt can be applied to processor only if INTE2 flip flop associated with IBF and controlled by PC4 is set by the processor earlier.

46 Interfacing Analog to Digital Converter
Introduction to analog to digital converter The basic function of the analog to digital converter is to convert the input analog voltage levels in to corresponding discrete digital signals. ADC is essential in a microprocessor based system as the microprocessor can only handle digital data but the real world signals are all in analog form only.

47 There are many types of ADC
There are many types of ADC. The major ones are counter ramp type ADC, dual slope ADC, Flash type ADC and Successive Approximation type ADC. Each type of ADC has its own advantages and disadvantages. Successive Approximation type ADC is commonly available ADC. This ADC has fixed conversion time for any analog input voltage level.

48 The specifications of the ADC are the range of analog input voltage, the number of digital bits at the output, resolution, the conversion time and the number of analog input channels. The analog input voltage can be either unipolar or bipolar. Unipolar means the input voltage can have only one polarity like (0 to +5V) or (0 to +10V). Bipolar means the input voltage can range from one polarity to the other like (-5V to +5V) or (-10V to +10V).

49 Most of the ADC chips come with an option of selecting one of these voltage ranges using Vref input pins. The ADC chips are available for different number of output binary bits. ADCs are available with 8 bits or 10 bits or 12 bits or 16 bits digital outputs. The number of bits will decide the number of voltage levels sensed. For example an eight bit ADC will have 28 possible levels i.e., 256 levels. The number of bits and the input voltage range will decide the resolution.

50 The resolution of an ADC is defined as the smallest change in the input voltage that can be sensed or detected at the output. The resolution can be mathematically defined as the range of input voltage divided by the number of levels at the output. For example, an ADC with the input voltage range of (0 to+5V) with 8 bits at the output will have a resolution of (5/256) i.e., approximately 19.5mV.

51 The conversion time of ADCs will be decided by the type of the ADC, and the clock frequency used in the converter circuits. Some ADC chips come with an option of having more than one analog input. One of these analog input channels are selected using select lines and an analog multiplexer circuit. The ADC chips also have a sample and hold circuit. The sample and hold circuit is used to maintain the analog input voltage constant when the conversion is in progress.

52 ADC chips and interfacing to microprocessor
The single chip analog to digital converters available in the markets are having many options. Commonly available ADC chip family is ADC080X from National Semiconductor. ADC 0800, ADC 0804, ADC 0808, ADC 0816 are the common chips available in this family. ADC 0804 has one analog input channel with 8 bit output. ADC 0808/0809 has eight analog inputs with three bit channel select lines and an 8 bit output. ADC 0816 has 16 analog input channels with four select lines and 8 bit outputs.

53 This section will discuss the operation and interfacing of ADC0816 with 8085 microprocessor through 8255 PPI. ADC 0816 is an 8-bit successive approximation type ADC chip with an in-built analog multiplexer which can select one of 16 analog inputs for conversion into digital format. One of 16 analog inputs IN0 to IN15 in the ADC0816 chip can be selected by the select lines A, B, C, D.

54 The analog to digital conversion can be started by using the active high control signal SC.
The conversion of the analog voltage on the input channel selected will then take place based on the clock signal applied to the ADC chip. After the conversion is over, ADC chip will issue an active high ‘end of conversion’ signal on the EOC line. The digital output can then be read from the data lines after issuing ‘Output Enable’ signal to the ADC chip.

55 Interfacing ADC0816 with 8255

56 In the interfacing diagram the Port A of 8255 is used to output or send the channel select lines and the related control signals. Port B lines are used to get or input the digital result data from the ADC chip.

57 Port C LSB is used to check the end of conversion signal
Port C LSB is used to check the end of conversion signal. With this hardware arrangement, the ADC chip can only be interfaced with software polling method. For interrupt driven interface, the EOC signal can be connected to any interrupt input. Analog inputs can be applied to the analog input pins of ADC 0816.

58

59 Control Word Format

60 The ADC conversion process can be started after applying the analog input to any of the channels.
The conversion process is started by initializing 8255 with the proper control word. Then the Channel selection and Start conversion is done simultaneously as these two control bits are tied together in the hardware.

61 The start conversion must be issued as a pulse for a minimum duration only. Then the conversion takes place in the ADC chip, if it is properly powered and clock pulses given. After the conversion, the logic high ‘End of conversion’ signal is issued by ADC chip. This is sensed in the software. Then the data is read from the data lines after issuing the logic high ‘Output Enable’ signal. The program for the ADC conversion process is given below as a software routine.

62 The following routine assumes that the channel number to be converted is available in the memory location named CH_NUM.

63

64 Interfacing Digital to Analog Converter
Digital to analog converters are used to get a proportional analog voltage or current for the digital data given out by the microprocessor. The D-A converters are essential in a microprocessor based systems as the real world applications are operating with analog data. Basically there are two types of DAC. They are R-2R ladder network and weighted resistor network. Many DAC chips are available in the market.

65 The specifications of the DAC chips are the full scale output voltage, number of binary input bits, resolution, linearity and settling time. The DAC chips come with choices in the maximum output voltage as 5V, 10V or with a predefined maximum current output. The number of binary input bits can be 4 bits or 8 bits or 10 bits or 12 bits. The number of bits and the full scale output voltage both will determine the resolution. For example, an 8 bit DAC can have 256 input combinations and so has a resolution of (1/256) or 0.39 percentage of the full scale output.

66 Similarly, the 10 bit DAC will have the resolution of (1/1024) or 0
Similarly, the 10 bit DAC will have the resolution of (1/1024) or percentage of the full scale output. Linearity is a measure of how straight the output is when the output is changed from minimum value to the maximum value. The settling time is defined as the time take for the output to settle within pre-specified band after the input digital value is applied. Normally, pre-specified band is [final value±(1/2)*Minimum possible output].

67 The settling time is an important specification as the DAC output may overshoot the correct value and may oscillate for some time before settling. The settling time for a DAC chip should be considered in applications where high frequency operation is essential. Digital to analog converters are required to generate the variable analog voltage essential for control applications Most of the speech synthesizers required a DAC to convert the binary data in to the corresponding analog speech signal.

68 DAC 0800 is a common digital to analog converter chip that can be easily interfaced to 8085 through This section will describe the interfacing of DAC 0800 with the 8085 processor. As the DAC chip can only be connected to an output port of a processor, the 8255 PPI is essential in the interface. Any one port is enough to interface an 8-bit DAC with 8255.

69 The other control signals are directly correspondingly connected to either logic 0 or logic 1. The DAC chip gives a proportional current output. This current output in most cases is difficult to measure and so a current to voltage (I to V) converter is used at the output. DAC chips have an inbuilt latch. This latch stores the digital input given by the port A and gives out a proportional voltage.

70 Interfacing DAC 0800 with 8085

71 Four common applications such as square wave generation, ramp wave generation, staircase wave generation and sine wave generations are discussed.


Download ppt "Chapter 7 Features and Interfacing of Programmable Devices for 8085 based systems."

Similar presentations


Ads by Google