Overview Some examples of I/O Devices Synchronous data transfers Asynchronous data transfers Source-initiated data transfer without handshaking Destination-initiated data transfer without handshaking Source-initiated data transfer with handshaking Destination-initiated data transfer with handshaking Programmed I/O A thermostat The control algorithm of Thermostat
Examples of I/O Devices A personal computer Keyboard (input) Mouse(input) Monitor(output) Printer(output) Microwave ovens Sensor(input) Output signals
Devices Interface Controler Data I/O CPU Address bus Data bus Control bus
Synchronous data transfers Synchronous transfers usually occur when peripherals are located within the same computer as the CPU because their close proximity allows them to share a common clock and because data does not have to travel very far physically, which becomes a concern at a higher clock frequencies.
Asynchronous data transfers A computer can make use of asynchronous data transfers when synchronous transfers are not viable. Asynchronous transfers use control signals and their associated hardware to coordinate the movement of data. These data transfer do not require that the source and destination use the same system clock. There are four types of asynchronous data transfers.
The source outputs its data. Then strobes a control signal for a set amount of time. The destination device reads in the data during this time. The source device next desserts the strobe and stops outputting data.
Destination-initiated data transfer without handshaking The destination device transmits a data strobe signal to the source device which, after a brief delay, makes data available. The destination device reads in this data The destination device deasserts the data strobe.
For some devices, particularly electromechanical devices, do not require the same amount of time for every transfer, they can use handshaking to coordinate their transfers. Handshaking uses an additional control signal to indicate that data is ready or has been read in.
The timing for a source- initiated data transfer with handshaking
The source sets the data request signal high. Makes valid data available to the destination device The destination device reads in data. The destination device sends a data acknowledge signal to the source. The source sets its data request line low and stops sending data. The destination then resets its data acknowledge signal.
Similar to that of the source-initiated data transfer using handshaking, except that the data-acknowledge signal is replaced by a data-ready signal.
Definition: Programmed I/O is exactly what its name implies: A program instruction causes the CPU to input or output data. Programmed I/O can be either isolated or memory mapped. Isolated I/O uses separate instructions to access I/O ports. Memory-mapped I/O treats I/O ports as memory locations.
It perform the following sequence of operation: 1.Read temperature from external sensor. 2.If (temperature > thermostat setting +2) then turn on air conditioner. 3.If (temperature < thermostat setting and air conditioner is on) then turn off air conditioner. 4.If (temperature < thermostat setting – 2) then turn on heat. 5.If (temperature > thermostat setting and heat is on) then turn off heat. 6.Go to start of sequence.
1.Illustration An input port at address FFFFH Whenever the illustration LDAC FFFF is executed, the CPU reads data from this port and stores it in its accumulator register. 2.Implementation Design the hardware for the input port Makes data available to the CPU The CPU would read the data from the data bus
1.The tri-state buffers are only enable when: The address bus contains the value FFFFH Control bus signal READ= 1 2.Data from the input port passes on to the data bus of the computer. 3.Data is read in by the CPU. 4.Data stored in data register. 5.CPU moves data from its data register into its accumulator.
1.The software programmer is responsible for: The CPU never attempts to access memory location FFFFH The input port has been assigned to this address It cannot be used by a memory location 2.This is one of the limitation of memory-mapped I/O.
1.The CPU reads in the current temperature from the memory-mapped input port at address FFFH 2.The thermostat setting from the port at address FFFE 3.The CPU controls the heating and air conditioning system. 4.Writing one of the four values to the output port at address FFFD 01 = turn on air conditioning 02 = turn off air conditioning 03 = turn on heat 04 = turn off heat 5.The current status is stord in memory location 1000H 00 = heat and air conditioning are both off FF = heat is on FE = air conditioning is on
NEW INSTRUCTION InstructionInstruction Code Operation INPT TAC Input port T OTPT TOutput port T AC
New control signals 1.When using isolated I/O Need a signal to distinguish between memory references and I/O references 2.Without this signal, it is not possible to tell whether an address refers to a memory location or to an I/O port 3.We create a new signal called IO IO = 1 for input/ output operations IO = 0 for memory reference operations
1.Difference between INPT instruction and the LDAC instruction. In state LDAC4, the LDAC instruction reads data from memory. During the corresponding state of the INPT instruction’s execute routine, it must read data from an input port.
The modification the state diagram for the CPU
Modify the CPU hardware for the new instruction
Summary Synchronous data transfers Asynchronous data transfers Source-initiated data transfer without handshaking Destination-initiated data transfer without handshaking Source-initiated data transfer with handshaking Destination-initiated data transfer with handshaking Programmed I/O A thermostat