Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
04-612-307 ระบบคอมพวิเตอร์และการเช่ือมโยง Computer Systems and Interfacing
บทที ่1 พืน้ฐานดจิติอล
สาขาวชิาวศิวกรรมคอมพวิเตอร์คณะวศิวกรรมศาสตร์ มหาวิทยาลยัเทคโนโลยรีาชมงคลพระนคร
Digital and Analog Quantities
Digital and Analog Quantities
Analog quantities have continuous valuesDigital quantities have discrete sets of values
Digital and Analog Quantities
Analog quantities have
continuous valuesDigital quantities have
discrete sets of values
Digital and Analog Quantities
Types of electronic devices or instruments:AnalogDigitalCombination analog and digital
Binary Digits, Logic Levels, and Digital Waveforms
Binary Digits, Logic Levels, and Digital Waveforms
The conventional numbering system uses ten digits: 0,1,2,3,4,5,6,7,8, and 9.
The binary numbering system uses just two digits: 0 and 1.
Binary Digits, Logic Levels, and Digital Waveforms
The two binary digits are designated 0 and 1
They can also be called LOW and HIGH, where LOW = 0 and HIGH = 1
Binary Digits, Logic Levels, and Digital Waveforms
Binary values are also
represented by voltage levels
Binary Digits, Logic Levels, and Digital Waveforms
Major parts of a digital pulseBase lineAmplitudeRise time (tr)Pulse width (tw)Fall time (tf)
Binary Digits, Logic Levels, and Digital Waveforms
T
1f
tw = pulse widthT = period of the waveform f = frequency of the waveform
Binary Digits, Logic Levels, and Digital Waveforms
%100T
tcycle Duty w
The duty cycle of a binary waveform is
defined as:
Basic Logic Operations
Basic Logic Operations
There are only three basic logic operations:
Basic Logic Operations
When the input is LOW, the output is HIGHWhen the input is HIGH, the output is LOW
The NOT operation
The output logic level is
always opposite the input
logic level.
Basic Logic Operations
The AND operation When any input is LOW, the output is LOW When both inputs are HIGH, the output is HIGH
Switch S1 AND Switch S2 must be
closed to light the lamp
Basic Logic Operations
The OR operation
When any input is HIGH, the output is HIGH When both inputs are LOW, the output is
LOW
Switch S1 OR Switch S2 (or both of
them) must be closed to light the
lamp
Introduction
Gates are identified by their function: NOT, AND, NAND, OR, NOR, EX-OR and EX-NOR.
Switch S1 OR Switch S2 (or both of
them) must be closed to light the
lamp
Switch S1 AND Switch S2 must be
closed to light the lamp
Three basic logic gates
Common logic gates
NAND and NOR gates are logically equivalent to AND and OR gates followed by inverters. Since NAND is actually easier to build, ANDs are often constructed as inverted NAND gates.
Example: logic diagram for a + b’c
More complicated expression
The logic diagram above depicts ((ab + bc’)a)’For a parenthesized expression, construct parenthesized portion first
Note the connectors () used to indicate a continuation of the same input (for a and b)
Same expression, abbreviated
Two inverters eliminated: first by including c’ as an input (instead of c) and second by making the third AND gate a NAND gate
In this version, inputs a and b are shown multiple times – use same symbols, so we know they’re the same inputs
One more example
To translate logic diagram to Boolean expression: label output of each gate (starting from left) with appropriate sub-
expression output of last gate is full expression
Fixed-Function Integrated Circuits
Fixed-Function Integrated Circuits
IC package stylesDual in-line package (DIP)Small-outline IC (SOIC)Flat pack (FP)Plastic-leaded chip carrier (PLCC)Leadless-ceramic chip carrier (LCCC)
Fixed-Function Integrated Circuits
Dual in-line package (DIP)
Fixed-Function Integrated Circuits
Small-outline IC (SOIC)
Fixed-Function Integrated Circuits
Flat pack (FP)
Fixed-Function Integrated Circuits
Plastic-leaded chip carrier (PLCC)
Fixed-Function Integrated Circuits
Leadless-ceramic chip carrier (LCCC)
Introduction to Programmable Logic
Introduction to Programmable Logic
SPLD—Simple programmable logic devicesCPLD—Complex programmable logic devicesFPGA—Field-programmable gate arrays
Introduction to Programmable Logic
SPLD PAL (programmable array logic) GAL (generic array logic) PLA (programmable logic array) PROM (programmable read-only memory)
Test and Measurement Instruments
Analog OscilloscopeDigital OscilloscopeLogic AnalyzerLogic Probe, Pulser, and Current ProbeDC Power SupplyFunction GeneratorDigital Multimeter
Number Systems
Decimal Numbers
The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9
The decimal numbering system has a base of 10 with each position weighted by a factor of 10:
Binary Numbers
The binary number system has two digits: 0 and 1
The binary numbering system has a base of 2 with each position weighted by a factor of 2:
Decimal-to-Binary Conversion
Decimal-to-Binary Conversion
Sum-of-weights methodRepeated division-by-2 methodConversion of decimal fractions to binary
Binary Arithmetic
Binary Arithmetic
Binary additionBinary subtractionBinary multiplicationBinary division
Complements of Binary Numbers
Complements of Binary Numbers
1’s complements2’s complements
Complements of Binary Numbers
1’s complement
Complements of Binary Numbers
2’s complement
Signed Numbers
Signed Numbers
Signed-magnitude form1’s and 2’s complement formDecimal value of signed numbersRange of valuesFloating-point numbers
Signed Numbers
Signed-magnitude form The sign bit is the left-most bit in a signed binary number A 0 sign bit indicates a positive magnitude A 1 sign bit indicates a negative magnitude
Signed Numbers
1’s complement form A negative value is the 1’s complement of the corresponding positive
value
2’s complement form A negative value is the 2’s complement of the corresponding positive
value
Signed Numbers
Decimal value of signed numbers Sign-magnitude 1’s complement 2’s complement
Signed Numbers
Range of Values2’s complement form:
– (2n – 1) to + (2n – 1 – 1)
Hexadecimal Numbers
Hexadecimal Numbers
Decimal, binary, and hexadecimal numbers
Hexadecimal Numbers
Binary-to-hexadecimal conversionHexadecimal-to-decimal conversionDecimal-to-hexadecimal conversion
Hexadecimal Numbers
Binary-to-hexadecimal conversion1. Break the binary number into 4-bit groups2. Replace each group with the hexadecimal equivalent
Hexadecimal Numbers
Hexadecimal-to-decimal conversion1. Convert the hexadecimal to groups of 4-bit binary2. Convert the binary to decimal
Hexadecimal Numbers
Decimal-to-hexadecimal conversion Repeated division by 16
Binary Coded Decimal (BCD)
Binary Coded Decimal (BCD)
Decimal and BCD digits
Digital Codes
Digital Codes
Gray codeASCII code
Digital Codes
Gray code
Digital Codes
ASCII code (control characters)
Digital Codes
ASCII code (graphic symbols 20h – 3Fh)
Digital Codes
ASCII code (graphic symbols 40h – 5Fh)
Digital Codes
ASCII code (graphic symbols 60h – 7Fh)
Digital Codes
Extended ASCII code (80h – FFh)Non-English alphabetic charactersCurrency symbolsGreek lettersMath symbolsDrawing charactersBar graphing charactersShading characters
Decoders
Decoders
Binary decoder4-bit decoderBCD-to-decimal decoderBCD-to-7-segement decoder
Decoders
Binary decoderThe output is 1 only when:
A0 = 1A2 = 0A3 = 0A4 = 1
This is only one of an infinite
number of examples
Encoder/Decoder Vocabulary
ENCODER- a digital circuit that produces a binary output code depending on which of its inputs are activated.
DECODER- a digital circuit that converts an input binary code into a single numeric output.
ENCODERS AND DECODERS
A0
A1
A2
A3
A4
A5
A6
A7
ENCODER
O0
O1
O2
A0
A1
A2
O0
O1
O2
O3
O4
O5
O6
O7
DECODER
ONLY ONE INPUT
ACTIVATED AT A TIME
BINARY CODE OUTPUT
BINARY CODE INPUT
ONLY ONE OUTPUT
ACTIVATED AT A TIME
THE 8421 BCD CODE
BCD stands for Binary-Coded Decimal.
A BCD number is a four-bit binary group that represents one of the ten decimal digits 0 through 9.
Example:
Decimal number 4926 4 9 2 6
8421 BCD coded number 0100 1001 0010 0110
ELECTRONIC ENCODER -
DECIMAL TO BCD
0
Decimal
to
BCD
Encoder
BCD output
Decimal input0 0 0 0
5
0 1 0 1
7
0 1 1 1
3
0 0 1 1
• Encoders are available in IC form.
• This encoder translates from decimal
input to BCD output.
10 line to 4 line Encoder
ENCODER
1248
DECIMAL BINARY (BCD)
9 5V
8 5V
7 5V
6 5V
5 5V
4 5V
3 5V
2 5V
1 5V
74147I9I8I7I6I5I4I3I2I1
A0A1A2A3
10 line to 4 line Encoder
0
1
2
3
4
5
6
7
8
9
DECODER
BINARY (BCD)
DECIMAL
1 0V
2 0V
4 0V
8 0V
74LS42
A3A2A1A0
9876543210
4 line to 10 line Decoder
BCD-to-
7-Segment
Decoder/
Driver
DECODERS: BCD TO
7-SEGMENT DECODER/DRIVER
BCD input
0 0 0 0
Decimal outputLED
0 0 0 10 0 1 00 0 1 10 1 0 0
• Electronic decoders are available in IC form.
• This decoder translates from BCD to decimal.
• Decimals are shown on an 7-segment LED display.
• This IC also drives the 7-segment LED display.
7-segment display
There are two types of 7segment LED displays; common - anode common - cathode
81
In commonanode, the anode of all of the LEDs are tied together to positive of the power supply (Vcc) as shown
82
Common Anode
Common Cathode
In commoncathode, the cathode of all of the LEDs are tied together to ground as shown.
83
GND
BCD-to-
7-Segment
Decoder/
Driver
BCD inputDecimal output
0 0 1 1
?
Q #1- What is the decimal output from the decoder that appears on the 7-segment display?
Answer: 3
Q #2- What is the decimal output from the decoder that appears on the 7-segment display?
0 0 0 0
Answer: 0
Q #3- What is the decimal output from the decoder that appears on the 7-segment display?
1 0 0 1
Answer: 9
Q #4- What is the decimal output from the decoder that appears on the 7-segment display?
Answer: 7
0 1 1 1
Q #5- What is the decimal output from the decoder that appears on the 7-segment display?
Answer: 6
0 1 1 0
TEST
BCD-TO-SEVEN SEGMENT DECODER DRIVER
5V
abcdef g .
V+
74LS47A3A2A1A0
testRBI
gfedcba
RBO