Digital Electronics Principles & Applications Seventh Edition Roger L. Tokheim Chapter 5 IC Specifications and Simple Interfacing ©2008 The McGraw-Hill Companies, Inc. All rights reserved. INTRODUCTION • Logic Levels/Noise Margin • Interfacing Families of ICs • Other Specifications • MOS and CMOS ICs • Interfacing with Switches • Interfacing with LEDs • Interfacing with Buzzers, Relays, Motors and Solenoids ©2008 The McGraw-Hill Companies, Inc. All rights reserved. INTRODUCTION (Continued) • Interfacing Using an Optoisolator • Current Sourcing and Sinking • Using a Stepper Motor • Using a Servo Motor • Hall-effect Sensor/Switch • Using the Hall-effect Switch • BASIC Stamp® Driving a Servo ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Logic Levels / Noise Margin • Voltage characteristic - defines logical 0 (LOW) or logical 1 (HIGH) • Noise immunity (noise margin)- logic circuit’s insensitivity or resistance to undesired voltages called “noise.” TTL Voltage Profiles Chart Input Output LOW GND - 0.8V HIGH 2.0 - 5.5V GND - 0.4V (0.1V typical) 2.4 - 5.5V (3.5V typical) ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. An input voltage of 0.4V to a TTL IC (5V power supply) would be interpreted as a logical __________ (0 or LOW, 1 or HIGH). 0 or LOW 2. An input voltage of 3V to a TTL IC (5V power supply) would be interpreted as a logical __________ (0 or LOW, 1 or HIGH). 1 or HIGH 3. A typical HIGH output from a TTL IC (5V power supply) would be about __________ (0.1V, 3.5V). 3.5V 4. A logic circuit’s insensitivity or resistance to undesired voltages (called noise) is __________ (noise margin, noise clutter). noise margin ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Input Voltage Profiles – TTL and 4000 Series CMOS Input Voltage Profiles +5V TTL 100% CMOS HIGH LOW GND 90% 80% HIGH 70% 60% 50% 40% 30% 20% 10% LOW 0% +10V CAUTION Undefined OutputUndefined VLOW profile differs logic HIGH reading may 0+3 toprobe +3V for CMOS Other families profile to +7VVfor CMOSdiffers depending on +7V +10V - for CMOS 0vary tototo +0.8V TTL +0.8V +2.0Vin TTL manufacturer +2V to +5V - TTL ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. An inexpensive hand-held instrument called a __________ (logic probe, oscilloscope) is commonly used to check logic levels in TTL or CMOS circuits. logic probe 2. An input voltage of 1V to a CMOS IC (10V power supply) would be interpreted as a(n) __________ (HIGH, LOW, undefined) input. LOW 3. An input voltage of 5V to a CMOS IC (10V power supply) would be interpreted as a(n) __________ (HIGH, LOW, undefined) input. undefined 4. An input voltage of 9V to a CMOS IC (10V power supply) would be interpreted as a(n) __________ (HIGH, LOW, undefined) input. HIGH ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ TTL Voltage Profiles INPUT OUTPUT +5V +5V H H Input +1.2V Input==+0.3V +4V +2.2V Output = ? +2.4V +2V ? ? Undefined ? HIGH LOW +0.8V Low GND +0.4V GND Low ©2008 The McGraw-Hill Companies, Inc. All rights reserved. TTL-to-CMOS Interfacing • Interfacing is the design of circuitry between devices. • Interface circuitry shifts levels of voltage & current for compatibility. • TTL and CMOS HIGH and LOW voltage profiles are different. • Current requirements for TTL and CMOS are different. • Example: Pull up resistor Design Notes: 1. Output current of TTL OK to drive CMOS device. 2. Output voltage profile does NOT fit CMOS input voltage profile. 3. Use pull up resistor as interface device to adjust voltage profiles. Standard TTL CMOS ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The design of circuitry that translates voltages and currents between devices (such as between TTL and CMOS) is called __________ (boundary scanning, interfacing). 2. Interface circuitry shifts levels of __________ (current and voltage, time and temperature) for compatibility between two devices or circuits. 3. In TTL-to-CMOS interfacing, a __________ (pull-up, temperature-sensitive) resistor is used to shift voltage levels. 4. The voltage profiles for TTL and CMOS are __________ (different, the same). interfacing current and voltage pull-up different ©2008 The McGraw-Hill Companies, Inc. All rights reserved. CMOS-to-TTL Interfacing • Interfacing is the design of circuitry between devices. • Interface circuitry shifts levels of current & voltage for compatibility. • CMOS and TTL voltage profiles are different. • Current requirements for CMOS and TTL are different. • Example: CMOS buffer (like 4050 IC) CMOS Design Notes: 1. Output voltage profile of CMOS is OK to drive TTL inputs. 2. Output current from CMOS is NOT enough to drive standard TTL. 3. Use special purpose CMOS buffer IC to adjust the current levels. Standard TTL ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The design of circuitry to make TTL-toCMOS or CMOS-to-TTL connections is called __________. interfacing 2. TTL and CMOS voltage profiles are __________ (different, the same). different 3. TTL and CMOS current input requirements and output drive capabilities are __________ (different, the same). different 4. Interfacing standard TTL-to-CMOS involves using a(n) __________ (buffer, pull-up resistor) between the input TTL and CMOS devices. pull-up resistor ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Other Digital IC Specifications • Drive Capabilities - sometimes referred to as fan-in or fan-out. • Fan Out - number of inputs of a logic family that can be driven by a single output. The drive capability of outputs. • Fan In - the load an input places on an output. • Propagation Delay - has to do with the “speed” of the logic element. Lower propagation delays mean higher speed which is a desirable characteristic. • Power Dissipation - generally, as propagation delays decrease, power consumption and heat generation increase. CMOS is noted for low power consumption. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The __________ (fan out, quantum equivalence) refers to the drive capability of the outputs of a digital IC. 2. Faster digital ICs (a desirable characteristic) have __________ (higher, lower) propagation delays. fan out lower 3. The __________ (CMOS, TTL) family of digital ICs is known for its very low power consumption and is commonly used in battery powered products. CMOS ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The drive capability of logic device outputs is sometimes called __________ (fan in, fan out). It is the number of inputs of a logic family that can be driven by a single output. fan out 2. CMOS devices are noted for their extremely __________ (high, low) power consumption. low 3. A logic device with a low propagation delay would be considered to be a __________ (high, low) speed device. high 4. Several desirable characteristics of logic devices are good drive capabilities, low power consumption, and __________ (high, low) propagation delays. low ©2008 The McGraw-Hill Companies, Inc. All rights reserved. MOS and CMOS ICs • MOS stands for Metal-Oxide Semiconductor. • PMOS, NMOS, and CMOS are three technologies used to manufacture ICs. TTL is another very fast technology. • NMOS stands for Negative-channel Metal-Oxide Semiconductor. NMOS ICs are faster than PMOS. • PMOS stands for Positive-channel Metal-Oxide Semiconductor. • CMOS stands for Complementary Metal-Oxide Semiconductor. Both PMOS and NMOS devices are used it its manufacture. • CMOS ICs are noted for exceptionally low power consumption. • CMOS ICs were slower than bipolar digital ICs (such as TTL devices). • Transmission gates or bilateral switches are unique digital devices created using CMOS technology. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The MOS part of CMOS stands for metal-oxide semiconductor which is a technology used in producing ICs with __________ (high, low) power requirements. low 2. PMOS, NMOS and CMOS are three technologies that use field-effect transistors to fabricate modern digital ICs. (True or False) True 3. CMOS stands for negative-channel metal-oxide semiconductor and is a type of extremely highspeed high-power consumption digital IC. (True or False) False ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Interfacing with Switches Switch-to-TTL interfaces +5V Pull up resistor HIGH LOW HIGH LOW Pull Pull down down resistor resistor INPUT INPUT INPUT pulled HIGH by INPUT pulled HIGH by pulled LOW by pull up resistor pulled LOW by pull switch up resistor switch INPUT INPUT INPUT pulled LOW pulled LOW by by pulled by pulled HIGH HIGH by pull down down resistor pull resistor switch switch Switch-to-CMOS interfaces With pull up resistor With pull down resistor ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The component labeled A in the interfacing circuit is called a __________ (pull-down, pullup) resistor and is holding the input to the inverter HIGH. 2. The component labeled B in the interfacing circuit is called a __________ (pulldown, pull-up) resistor and is holding the input to the inverter LOW. 3. The output at point C is currently __________ (HIGH, LOW) because the pull-down resistor is holding the inverter’s input LOW. A pull-up pull-down B C HIGH ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Switch Debouncing • Mechanical switches that serve as inputs for some digital circuits (like counters) may need switch debouncing. • A Low-to-High switch transition can result in H-L-H bounces. • A demonstration of a debouncing circuit in action. Notice No switch bounce! Debouncing Latch HIGH LOW time ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The output waveform at A going L-H-L-H is referred to as a(n) __________ (analog, digital) signal. digital 2. The block labeled B is a switch __________ latch. debouncing 3. The L-H-L-H output of the SPDT switch on the left is debounced by the electronic device labeled B. (True or False) True A B HIGH LOW time ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Interfacing TTL or CMOS to LEDs +5 V Either TTL or CMOS ICs can drive an LED using a transistor. 150 W Left arrow key on keyboard to erase and see action again. HIGH LOW LOW HIGH TTL or CMOS Transistor OffON 33 kW ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. If point A goes HIGH point B will go LOW and the transistor will turn off causing the LED to __________ (turn off, turn on). turn off 2. If point B goes HIGH and the transistor will turn on causing the LED to __________ (turn off, turn on). turn on 3. The inverter can be from either the TTL or CMOS family of ICs and be able to drive the indicator LED. (True or False) A +5V True LED B ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Interfacing with Buzzers, Relays, Motors & Solenoids • Piezo buzzer - a signaling device drawing less current than older buzzers and bells. • DC or AC motors - produce continuous rotary motion. (Motor voltages and current not compatible with logic circuits.) • Solenoid - a device that can produce linear motion. • Relay - a device to isolate logic device from highvoltage/current circuit. • Optoisolator - a device to isolate logic device from high-voltage/current circuit. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Interfacing with a Piezo Buzzer Left arrow on keyboard to erase and see action again. No sound Buzzer sounds Transistor ON OFF Transistor LOW HIGH Goes Goes HIGH LOW ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. When the input to the inverter goes LOW, the buzzer __________ (does not sound, sounds). 2. When the input to the inverter goes HIGH, the input to the transistor goes LOW which turns __________ (OFF, ON) both the transistor and the buzzer. sounds OFF ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Isolation-Logic to High Voltage/Current • Electromechanical Relays - older method of isolation. Relays are expensive, heavy, and produce “noise.” • Optoisolator (Optocoupler) - light weight alternative to electromagnetic relay when interfacing with logic circuits. • Solid State Relay - a heavy-duty version of an optoisolator. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Interfacing Using a Relay N.O. relay contacts Electromechanical Relay Driver Transistor Left arrow key on keyboard to erase and view again. DC Motor (12 Volt) Low Voltage (+5V) Side of circuit High Voltage (12V) Side of circuit ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Interfacing Using a Relay to Control a DC Motor Coil notenergized energized Coil N.O. open N.O.contacts contactsremain snap closed DC motor does runs not run DC motor HIGH LOW LOW HIGH Transistor Transistor Off ON (Left arrow key on keyboard to erase and view again) ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. If the input to the inverter is LOW, the transistor will turn ON and the relay coil will be energized. (True or False) 2. If the input to the inverter is LOW, the transistor will turn ON, the relay coil will be energized, the N.O. relay contacts close, and the motor will run. (True or False) 3. If the input to the inverter is HIGH, the DC motor __________ (will, will not) run. True True will not ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Optical Isolation Solid state relay or optoisolator 120 VAC 5 VDC Load ground (Left click for L-to-H input signal) Logic ground ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Interfacing Using on Optoisolator Left arrow key on keyboard to erase and view again) Buzzer sounds No Sound HIGH LOW (Left click for action) LOW at at pin pin 22 of of IC IC HIGH LEDLED does lights not light ICs transistor ON Transistor OFF ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. If the input to the inverter is HIGH, the LED inside the optoisolator lights, the transistor turns __________ (ON and the buzzer sounds, OFF and the buzzer is silent). ON and the buzzer sounds 2. The optoisolator IC isolates the lower voltage (5V) input from the higher voltage (12V) output. (True or False) True 3. There is a low resistance electrical connection between the input logic circuits and the output buzzer circuit because of the optoisolator IC. (True or False) False ©2008 The McGraw-Hill Companies, Inc. All rights reserved. ICs Sourcing and Sinking Current An example of the IC Sourcing Current To drive the output LED (conventional current flow) Active-HIGH output Notice the IC has Active-HIGH output An example of the IC Sinking Current To drive the output LED (conventional current flow) Notice the IC has Active-LOW output Active-LOW output ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Stepper- and Servo-Motors • Stepper motor - a motor that rotates a fixed angle (in discrete steps) for each input pulse. The logic levels applied to each field coil are defined in the control sequence for the stepper motor. Can reverse direction by progressing either up or down the control sequence. • Servo motor (hobby-type servo) - a motor widely used in radio-control vehicles that rotates to an angle defined by the pulse width of the input signal. It is driven by pulse-width modulation. The pulse widths for hobby servos motors range from about 1- to 2-msec. Hobby servos have a limited range of rotation such as 180 degrees. ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Stepper Motor Operation Sequence Chart Step 1 2 3 4 1 2 L1 1 0 0 1 1 0 L1 L2 L2 0 1 0 1 1 0 1 0 1 0 0 1 0 1 0 1 1 0 Note: Use --> key for CW, then <-- key for CCW rotation) L1 L1 L2 L2 ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Servo Motor Input= Input= Input= 1.5 msec 12msec msec positive positive pulse positivepulse pulse 50Hz 50Hz 50Hz Output=centered Output=CW Output=CCW +5V Input Left arrow on keyboard to erase and see action again. End of output shaft ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The angular position of a servo motor’s shaft can be modified by varying the pulse voltage entering the input to the device. (True or False) False 2. Stepping upward or downward through a control sequence results in the stepping action (in small discrete steps) of a stepper motor. (True or False) True 3. If sequencing downward through the control sequence of a stepper motor causes CCW rotation, then reversing and going upwards CW or though the control sequence will cause __________ (CW, no) rotation of the output shaft. clockwise ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Hall-Effect Switch IC Bipolar Hall-effect Switch IC Output pin of IC Schmitt trigger (digitizes output) GND pin Vcc (+5V) Hall-effect sensor Output NPN transistor (Left arrow on keyboard to erase and view again) ©2008 The McGraw-Hill Companies, Inc. All rights reserved. Using the Hall-Effect Switch IC (Left arrow on keyboard to erase and view again) TransistorOFF ON Transistor Pin 33 goes goes HIGH LOW Pin SNpole poleapproaching approaching Hall-effect Hall-effectsensor sensor Turns ON transistor Turns OFF transistor LEDislights LED OFF South Northpole pole South pole North pole (Left click for action) ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. If the S pole of a magnet approaches the Hall-effect sensor of this IC the transistor will turn __________ (OFF and the LED will ON and the LED will light not light, ON and the LED will light). 2. If the N pole of a magnet approaches the Hall-effect sensor of this IC the transistor will turn OFF and the LED will not light. (True or False) 3. The output of the Hall-effect sensor is analog in nature but the device called a(n) __________ (NPN transistor, Schmitt trigger) changes this to a digital output. True Schmitt trigger ©2008 The McGraw-Hill Companies, Inc. All rights reserved. BASIC Stamp® Module Driving a Servo Motor Step 3: Disconnect PC from BS2 module PBASIC Code FOR C= 1 to 25 PULSOUT 14, 1000 ‘CCW rotation PAUSE 20 NEXT Step 2: Download program from PC moduleon PC in PBASIC Step 1: Write program FOR C=to1BS2 toOFF 25 Step 4: Power and ON (BS2 module). Keymotor lines14, of500 code are: Observe shaft rotation as program runs. PULSOUT ‘CW rotation Output- pin 14 FOR C = 20 1 to 25 ‘Begin counting loop PAUSE PULSOUT 14, 1000 ‘Emits 2ms pulses—CCW rotation NEXT PAUSE 20‘Pause 20ms NEXT ‘Repeat if C<25 FOR C = 1 to 25 ‘Begin counting loop PULSOUT 14, 500 ‘Emits 1ms pulses—CW rotation PAUSE 20‘Pause 20ms NEXT ‘Repeat if C<25 Hobby Servo Motor Left arrow on keyboard to erase and view again ©2008 The McGraw-Hill Companies, Inc. All rights reserved. QUIZ 1. The PULSOUT 14, 1000 line of code will cause the BASIC Stamp® to output a _____ (HIGH, LOW) pulse for 2ms (1000 x 2usec= 2ms) at pin 14 of the BS2 module. 2. The PAUSE 20 line of code will cause the BASIC Stamp® to output a LOW for 20ms. (True or False) 3. The FOR-NEXT loop will be repeated _____ (20, 1000) times. HIGH True 20 PBASIC code (BS2 module) 4. The 2ms positive output pulse generated by BS2 module can be used to rotate a hobby _____(servo, ac) motor in the CCW servo direction. FOR C= 1 to 20 PULSOUT 14, 1000 PAUSE 20 NEXT ©2008 The McGraw-Hill Companies, Inc. All rights reserved. REVIEW • Logic Levels/Noise Margin • Interfacing Families of ICs • Other Specifications • MOS and CMOS ICs • Interfacing with Switches • Interfacing with LEDs • Interfacing with Buzzers, Relays, Motors and Solenoids ©2008 The McGraw-Hill Companies, Inc. All rights reserved. REVIEW (Continued) • Interfacing Using an Optoisolator • Current Sourcing and Sinking • Using a Stepper Motor • Using a Servo Motor • Hall-effect Sensor/Switch • Using the Hall-effect Switch • BASIC Stamp® Driving a Servo ©2008 The McGraw-Hill Companies, Inc. All rights reserved.