Basic Digital I/O: Slide Switch, Push Button, and LED
Basic Input Devices: Slide Switch and Push Button
Circuits often require inputs that come directly from users (as opposed to inputs that come from other devices). User-input devices can take many forms, among them keyboards (as on a PC), buttons (as on a calculator or telephone), rotary dials, switches and levers, etc. Digilent® boards include several input devices, typically including push buttons and slide-switches. Since digital circuits operate with two voltage levels (LHV or Vdd, and LLV orGND), input devices like buttons and switches should be able to produce both of these voltages based on some user action.
The slide switches are also known assingle throw-double pole(STDP) switches, because only one switch (or throw) exists, but two positions (or poles) are available (a pole is an electrical contact to which the switch can make contact). These switches can be set to output either Vdd (when the actuator is closest to the board's edge) orGND. The push button switches are also known as “momentary” contact buttons, because they only make contact while they are actively being pressed—they output aGNDat rest, and a Vdd only when they are being pressed. The figure below shows typically push button and slide switch circuits used on Digilent boards.
Basic Output Devices: LED
Circuits often require output devices to communicate their state to a user. Examples of electronic output devices include computer monitors,LCDalphanumeric panels (as on a calculator), small lamps or light-emitting diodes (LED's), etc. Digilent boards include different output devices, but all of them include some number of individualLED's, and seven-segmentLEDdisplays that can display the digits 0-9 in each digit position (each segment in the seven-segment display contains a singleLED).LED's are two-terminal semiconductor devices that conduct current in only one direction (from the anode to the cathode). The smallLEDchips are secured inside a plastic housing, and they emit light at a given frequency (RED, YELLOW, etc.) when a small electric current (typically 10mA to 25mA) flows through them.
IndividualLED's are denoted with an “LD__” reference designator on Digilent boards, and seven-segment displays are denoted with a “DSP” reference designator. Individual LEDs are typically driven directly from a Xilinx® chip on Digilent boards, butLEDdisplays may require the use of an external transistor to supply higher currents to the digits. TypicalLED电路Digilent boards are shown in Fig. 4 below.
LEDs will not turn on unless their anodes are some minimal voltage above their cathodes—typically about two volts. If less than the minimum threshold voltage is applied to anLED, it will remain dark. In the example shown below, theLEDrequires a 2V drop to turn on, leaving 1.3V to drop across the resistor. Thus, a 130 ohm resistor is required to cause 10mA of current to flow in the circuit ($3.3V - 2V = 1.3V$, and 1.3V / 130 ohms = 10mA).
Important Ideas:
-
Switches and Push Buttons are commonly used as input devices for digital system. The output of the circuit can be changed between Vdd and Gnd by pressing/releasing the push button or sliding the switch. However the correspondence between output voltage and button press/release or switch sliding is determined by actual circuit configuration.
-
LEDis commonly used as a simple Digital output device. Usually on Digilent Board, a high voltage will light it up and a low voltage will shut it down.