Computer peripherals Whats a peripheral? Parallel Input/Output Serial communication A/D and D/A conversion Pulse width modulation Interrupts Computer peripherals Lecture slides 2006 1 Whats a peripheral? Any device connected to the bus system through a dedicated interface. address CP memory data control IO interface IO interface IO interface IO interface IO interface.g. Parallel I/O Serial I/O Disc drives Sensors Actuators... Computer peripherals Lecture slides 2006 2
Parallel Output bus 1 IO Interface ypical application ON/OFF LD (Light mitting Diode) ON Computer peripherals Lecture slides 2006 3 Parallel Output bus 0 IO Interface ypical application ON/OFF LD (Light mitting Diode) OFF Computer peripherals Lecture slides 2006 4
Parallel Input ypical application Sense ON/OFF switches bus 0 5V IO Interface Switch OFF Computer peripherals Lecture slides 2006 5 Parallel Input ypical application Sense ON/OFF switches bus 1 5V IO Interface Switch ON Computer peripherals Lecture slides 2006 6
Serial communication IOinterface: Serial Communication Interface (SCI) Central Processing nit Serial to parallel conversion Parallel to serial conversion Receive Data: RxD ransmit Data: xd Computer peripherals Lecture slides 2006 7 Parallel/serial conversions, asynchronous Sender Receiver Clock Shift Register xd Serial data out Serial data in RxD Clock Shift Register Requires Sender and Receiver Clocks to be the same... Computer peripherals Lecture slides 2006 8
Parallel/serial conversions, synchronous Master Slave Clock Shift Register xd Serial data out Serial data in RxD Shift Register Clock Out Clock In Requires xtra Wire and a Clock Master... Computer peripherals Lecture slides 2006 9 xample: RS232 Common asynchronous serial communication protocol, for wire lengths up to 25 meters (approx). Central Processing Serial to parallel conversion ransceiver Receive ransceiver Receive nit Parallel to serial conversion ransmit ransmit Serial transmission Computer peripherals Lecture slides 2006 10
RS232 transmission of z character z is represented by the bit pattern 0111 1010 (ASCIIcharacter). 10 volt 0 volt 10 volt S A R B I idle 0 0 1 0 1 1 1 1 0 0 1 idle P A R I Y B I S O P B I z least significant bit first Overhead, 3 bits plus the required idle time Computer peripherals Lecture slides 2006 11 D/A conversion Load, e.g. loudspeaker light bulb heater etc... Digital/Analog Converter Continous signal out Power Amplifier Computer peripherals Lecture slides 2006 12
Digital/Analog Converter (DAC) S 3 S 2 S 1 S 0 r R/8 R/4 R/2 R I I r 1 = R S S S S 8 4 2 1 3 2 1 0 Computer peripherals Lecture slides 2006 13 Digital/Analog Converter (DAC) Switches Currents I tot (ma) S 3 S 2 S 1 S 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 I 0 I 1 I 1 I 0 I 2 I 2 I 0 I 2 I 1 I 2 I 1 I 0 I 0 I 1 I 1 I 0 I 2 I 2 I 0 I 2 I 1 I 2 I 1 I 0 0 0,2 0,4 0,6 0,8 1,0 1,2 1,4 1,6 1,8 2,0 2,2 2,4 2,6 3,8 3,0 I tot ma 3,0 2,8 2,6 2,4 2,2 2,0 1,8 1,6 1,4 1,2 1,0 0,8 0,6 0,4 0,2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Digital value Computer peripherals Lecture slides 2006 14
A/D conversion Varying Voltage (input) sample and hold control convert bus sample and hold circuit Analog to Digital Converter (ADC) Data bus time Computer peripherals Lecture slides 2006 15 Analog/Digital Converter (ADC): Ramp t1: C is charged from the measured voltage t2: C is discharged Clock Counter Zero Voltage Sense Clock Counter Zero Voltage Sense = t t 2 1 t 1 t 2 t 1 t 2 Computer peripherals Lecture slides 2006 16
Analog/Digital Converter (ADC): Flash V in 7 6 5 4 3 2 8/3 Decoder 111 110 101 100 011 010 001 000 0 1 2 3 4 5 6 7 1 0 Computer peripherals Lecture slides 2006 17 Pulse Width Modulation (PWM) period dutycycle 1 out = 2 out = dutycycle period 3 out = 4 1 out = 4 Period and dutycycle are programmable... Computer peripherals Lecture slides 2006 18
PWM as replacement for DAC bus Data bus period Register dutycycle Register Load, e.g. loudspeaker light bulb heater etc... PWM Continous signal out Power Amplifier Computer peripherals Lecture slides 2006 19 Interrupts A peripheral can interrupt the CP, executing a program by means of a hardware signal, called Interrupt Request. he CP then acknowledge this request, freeze the current program and executes a dedicated Interrupt Handler. When the Interrupt Handler is finished the CP resumes execution of the interrupted program Computer peripherals Lecture slides 2006 20
Interrupts, hardware C P Address/Data/ buses address decode memory Signal: IRQ: (interrupt request) IOinterface Computer peripherals Lecture slides 2006 21 Interrupts, software main program interrupt handler hardware signal IRQ service interrupt RI special instruction: Reurn from Interrupt Computer peripherals Lecture slides 2006 22
Interrupts, multiple interrupt sources CP IRQ memory IRQ handler IRQ from A? N Y dispatch to dedicated interrupt handlers handler A IOinterface A SCI IOinterface B parallel input IOinterface C A/D input IRQ from B? N IRQ from C? Y Y handler B handler C N RI Computer peripherals Lecture slides 2006 23 Conclusion we we have got a brief introduction to to Whats a peripheral? Parallel Input/Output Serial communication A/D and D/A conversion Pulse width modulation Interrupts which finishes today s lecture...... Computer peripherals Lecture slides 2006 24