#### Transcript Lecture 6: Binary Counter

```Lecture 6
Binary Counter
Thinking Digitally
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
1
Henry Farny’s Song of the Talking Wire
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
2
2 Minute Quiz
Name_______ Sec_______Date_______
• Code Example:
• Code Example:
• Code Example:
• PWM Question:
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
3
Joseph Henry & the Telegraph
•
•
•
•
Assisted Morse at Princeton
Unit of inductance: Henry
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
4
Morse Code
• Simple sequences of short
and long clicks to represent
letters and numbers
• Easier to generate than
sound
• Easier to distinguish than
sound
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
5
UPC Codes
•Bars come in four
widths 1-2-3-4
•Start is 1-1-1 (blackwhite-black)
•
•
•
•
•
•
•
•
•
•
0 = 3-2-1-1
1 = 2-2-2-1
2 = 2-1-2-2
3 = 1-4-1-1
4 = 1-1-3-2
5 = 1-2-3-1
6 = 1-1-1-4
7 = 1-3-1-2
8 = 1-2-1-3
9 = 3-1-1-2
2/18/2004
•
•
•
•
•
•
•
The zero is 3-2-1-1 (space-bar-space-bar).
The four is 1-1-3-2 (space-bar-space-bar).
The three is 1-4-1-1 (space-bar-space-bar).
The next three zeros are 3-2-1-1 (space-bar-space-bar).
In the middle there is a standard 1-1-1-1-1 (space-barspace-bar-space), which is important because it means
the numbers on the right are optically inverted!
The one is 2-2-2-1 (bar-space-bar-space).
The stop character is a 1-1-1 (bar-space-bar).
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
6
Computer Number System Examples
From Computer Science I
10110101110001011001110011110110
11
B
5
5
12
C
5
9
5
12
9
B5C59CF6
2/18/2004
C
15
F
6
binary number
equivalent base 10 value for
each group of 4 consecutive
binary digits (bits)
6
(base 16) digit
number
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
7
Communicating With Pulses
• PCM: Pulse Code Modulation
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
8
PCM: Pulse Code Modulation
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
9
PWM: Pulse Width Modulation
• Signal is compared to a sawtooth wave
producing a pulse width proportional to
amplitude
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
10
• Receiver detects pulses of light
• Pulses are amplified and partly averaged by 741 opamp (volume adjusted with the pot)
 Higher frequencies still in signal cannot be heard
• Signal is increased by 386 audio amp
• 386 audio amp drives the speaker
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
11
Optical Transmitter
• Audio signal changes thresholds for 555
timer producing a type of pulse width
modulation of the light from the LED.
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
12
Signals from Audio Remote
54603B, CHAN1, 09:22, 9/20/2002
54603B, CHAN1, 09:23, 9/20/2002
8
8
6
6
4
4
2
2
0
0
20.0 ms/
5.00 ms/
Mostly hear higher frequencies in pulses
3.5 x 20 = 70ms or 14Hz
54603B, CHAN1, 09:24, 9/20/2002
54603B, CHAN1, 09:25, 9/20/2002
8
8
6
6
4
4
2
2
0
0
500 us/
4 x 500 = 2000us or 500Hz
2/18/2004
100 us/
2 x 100 / 9 = 23us or 43kHz
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
13
Binary Numbers
0
1
2
3
4
5
0000
0001
0010
0011
0100
0101
6
7
8
9
10
11
0110
0111
1000
1001
1010
1011
Byte
Lower Nibble
Upper Nibble
Bit
7
Bit
6
Bit
5
Bit
4
Bit
3
Bit
2
Bit
1
Bit
0
1
0
1
1
0
1
1
1
2
128
2/18/2004
7
+
2
+ 0
6
+
+
2
5
+
32 +
2
4
3
+
2
+
16 +
0
+
2
1
2
4
+
+
2
0
=183
2
+
2
Binary
number
+
1
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
=
183
14
Binary Counter
• Animations showing counter operation
http://www.play-hookey.com/digital/synchronous_counter.html
• Counter for lab
1
2
9
10
7
6
5
4
3
CL
CLK
LD
TE
PE
CO
P4
P3
P2
P1
Q4
Q3
Q2
Q1
15
11
12
13
14
14161
2
-
+
1
5V
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
15
Typical Output for Binary Counter
• Note how the Q outputs form 4 bit numbers
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
16
Digital Pulses
• Function generator produces a 1kHz
sinusoidal voltage. 1v peak-to-peak (pp)
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
17
Digital Pulses
• Switch to a square wave at 1kHz. Still
1v pp
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
18
Digital Pulses
• Add a 0.5 volt offset so that the square wave
goes from 0 volts to 1 volt
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
19
Digital Pulses
• Now the duty cycle is adjusted to 20% to see
what a single digital pulse looks like.
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
20
10
10
8
8
6
6
4
4
Pulse Voltage
Pulse Voltage
Pulses on a Transmission Line
2
0
-2
2
0
-2
-4
-4
-6
-6
-8
-10
0
0.2
0.4
0.6
Distance Along The Line
0.8
1
From
Matlab
-8
-10
0
0.2
0.4
0.6
Distance Along The Line
0.8
1
• Pulses propagate down transmission lines at the
speed of light. They reflect off of the load if the load is
not the same impedance as the line. Lines, sources
• Cable TV lines are 75 ohms. Cables in the lab are
typically 50 ohms.
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
21
What Can Be Done With PWM?
Low
Duty Cycle
Medium
Duty Cycle
High
Duty Cycle
• Question: What happens if voltages like
the ones above are connected to a light
bulb? (4th 2 Minute Quiz Question)
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
22
What Can Be Done With PWM?
• Average power can be controlled
• Average flows can also be controlled by fully
opening and closing a valve with some duty
cycle
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
23
• AM: Amplitude
Modulation
• FM: Frequency
Modulation
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
24
Other Coding Applications
• Cryptography
• Image Compression





JPEG (Joint Photographic Expert Group)
GIF (Graphics Interchange Format)
TIFF (Tagged Image File Format)
MPEG (Compression of Motion Video)
Most use Discrete Cosine Transform
method
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
25
Image Compression
2 bpp
0.5 bpp
24 bpp original
(bits per pixel)
Top: JPEG
Bottom: JPEG2K
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
26
2 Minute Quiz
• Code Example: MORSE, UPC
• Code Example: BINARY
• Code Example: PWM
• PWM Question: The longer the duty cycle, the
longer the light bulb is on and the brighter the
light
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
27
Where Will You See This Material Again?
• 555 Timer – IEE Lab 6
• Digital Counter – IEE Lab 7
• Counters: ECSE- 2610 Computer Components
and Operations, ENGR-2350 Introduction to
Embedded Control
• Signals and Transforms: ECSE-2410 Signals and
Systems
• Pulse Width Modulation: Embedded Control,
ECSE/EPOW-4080 Semiconductor Power
Electronics
• Pulses on Transmission Lines: ECSE-2100
Fields and Waves I
2/18/2004
Introduction to Engineering Electronics
STOLEN FROM K. A. Connor
28
```