You are on page 1of 26

Pertemuan 1

Teknik Digital 1

http://zulhelman64.wordpress.com/digital-electronic/
zulhelman
PNJ
zuhelman@yahoo.co.id

Elektronika Digital

Number Systems and Logic


Gerbang Logika
Rangkaian Logika Kombinasional
Rangkaian Sequensial
Rangkaian ADC DAC
Memory

Materi :

Data Digital vs Data Analog


Input dan Output Binary
Sistem Bilangan Binary, octal, decimal and
hexadecimal.
Pengkodean Biner

Sistem Analog

V(t) can have any value between its minimum and


maximum value

V(t)

Sistem Digital

V(t) must take a value


selected from a set of
values called an
alphabet
Binary digital systems
form the basis of
almost all hardware
systems currently

V(t)

For example, Binary Alphabet: 0, 1.

Analogi

Consider a childs slide in a playground:

a set of discrete steps


continuous movement

levels

Hubungan Antara sistem


Analog dan sistem Digital

Keuntungan Sistem Digital


Analogue systems: eror yang
kecil di input menghasilkan error
yang besar di output
Sistem Digital lebih akurat dan
reliable
Computers use digital circuits
internally
Interface circuits (for instance,
sensors and actuators) are often
analogue

5 Volt

Input
Range
for 1

Output
Range
for 1
2.8
2.4

Input
Range
for 0

0.8
0.4
0 Volt

Output
Range
for 0

Input dan Output Biner

Coding:
A single binary input can only have two
values: True or False (Yes or No) (1 or
0)

Binary

More bits = more combinations

00

01

Each additional input doubles the number of


combinations we can represent
i.e. with n inputs it is possible to represent 2n
combinations

10

1 1

Combinations

Example 1:

How many combinations are possible with 10 binary


inputs?

Example 2:

What is the minimum number of bits needed to


represent the digits 0 to 9 as a binary code?

Decimal systems

Number Representation

Difficult to represent Decimal numbers directly in a


digital system
Easier to convert them to binary
There is a weighting system:
eg
403 = 4 x 100 + 0 x 10 + 3 x 1
or in, powers of 10:
40310= 4x102 + 0x101 + 3x100 = 400 + 0 + 3

Binary Inputs and Outputs

Both Decimal and Binary numbers use a positional


weighting system, eg:
10102 = 1x23+0x22+1x21+0x20 = 1x8 + 0x4 + 1x2 + 0x1 = 1010
decimal

binary

100 (102)

10 (101)

1 (100)

8 (23)

4 (22)

2 (21)

1 (20)

400 + 0 + 3

8+0+0+1

Binary to decimal

Multiply each 1 bit by the appropriate power of 2 and add them


together.

?
1

128

64

32

16

100000112 = .10 ?
1010011002 = 10 ?

Binary Inputs and Outputs

Number Representation - Binary to decimal


A decimal number can be converted to binary by repeated division by 2

number

/2

remainder

155

77

77

38

38

19

19

Least Significant Bit

Most Significant bit

15510 = 100110112

Decimal to Binary
An alternative way is to use the placement method

128

64

32

16

128 goes into 155 once leaving 27 to be placed


So 64 and 321are too big (make them zero)
16 goes in once leaving 11

and so on

Representations

There are different ways of representing decimal


numbers in a binary coding

BCD or Binary Coded Decimal is one example.

Each decimal digit is replaced by 4 binary digits

Binary Inputs and Outputs

6 of the possible 16 values unused

example 45310 = 0100 0101 0011BCD

Note that BCD code is longer than a direct


representation in natural binary code:

453 = 111000101

Decimal
0
1
2
3
4
5
6
7
8
9

BCD
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001

Binary Inputs and Outputs

Hexadecimal and Octal


Writing binary numbers as strings of 1s and 0s can be very
tedious
Octal (base 8) and Hexadecimal (base 16) notations can be
used to reduce a long string of binary digits.
octal

hexadecimal

512 (83)

64 (82)

8 (81)

1 (80)

256 (162)

16 (161)

1 (160)

512 + 128 + 7

256 + 160 + 15

Notice that hexadecimal requires 15 symbols (each number system needs 0


base-1 symbols) and therefore A F are used after 9.

Octal as shorthand for Binary

Each octal digit corresponds to 3 binary bits

binary

octal

000

001

010

011

100

101

110

111

To convert a binary string:

10011101010011

Split into groups of 3:


010 011 101 010 011
2

Thus 100111010100112 = 235238

Similarly with Hexadecimal

Each hex digit corresponds to 4 binary bits

binary

hex

binary

hex

0000

1000

0001

1001

0010

1010

0011

1011

0100

1100

0101

1101

0110

1110

0111

1111

To convert a binary string:


10011101010011

Split into groups of 4:


0010 0111 0101 0011

Thus 100111010100112 = 16 ?

Binary inputs and outputs

Colour codes

You often see hex used in graphic design programs for


the red, blue and green components of a colour:

FF0000 represents red, for example.

How many bits are used to represent each colour?

How many different colours can be represented?

Binary Inputs and Outputs

Characters

Three main coding schemes used: ASCII (widespread


use), EBCDIC (not used often) and UNICODE (new)
ASCII table (in hex) :
00 01 02 03 04 05 06 07 08 09 0a 0b
nul soh sot etx eot enq ack bel bs
ht
nl
vt
10 11 12 13 14 15 16 17 18 19 1a 1b
dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc
20 21 22 23 24 25 26 27 28 29 2a 2b
sp
!
"
#
$
%
&
'
(
)
*
+
30 31 32 33 34 35 36 37 38 39 3a 3b
0
1
2
3
4
5
6
7
8
9
:
;
40 41 42 43 44 45 46 47 48 49 4a 4b
@
A
B
C
D
E
F
G
H
I
J
K
50 51 52 53 54 55 56 57 58 59 5a 5b
P
Q
R
S
T
U
V
W
X
Y
Z
[
60 61 62 63 64 65 66 67 68 69 6a 6b
`
a
b
c
d
e
f
g
h
i
j
k
70 71 72 73 74 75 76 77 78 79 7a 7b
p
q
r
s
t
u
v
w
x
y
z
{

0c
np
1c
fs
2c
,
3c
<
4c
L
5c
\
6c
l
7c

0d
cr
1d
gs
2d
3d
=
4d
M
5d
]
6d
m
7d
}

0e 0f
so
si
1e 1f
rs
us
2e 2f
.
/
3e 3f
>
?
4e 4f
N
O
5e 5f
^
_
6e 6f
n
o
7e 7f
~ del

Gray Codes

Dec
0
1
2
3
E.g. changing from 3 to 4, normal binary has 4
all three bits changing 011 -> 100.
5
Depending on the order in which the bits
6
change any intermediate value may be
created.
7

Other codes exist for specific purposes


Gray codes provide a sequence where
only one bit changes for each increment
Allows increments without ambiguity due
to bits changing at different times.

Gray
000
001
011
010
110
111
101
100

Konversi Biner ke kode Grey :


Caranya adalah dengan menambahkan angka paling depan ke belakang.
contoh 1 : konversikan 0010(2) =............(Grey code)
catatan :
0
0
0
exor 0 = 0
0
exor 1 = 1
1
Exor 0 = 1 angka ke-empat
hasil konversi 0010(2) = 0011(Grey code)
contoh 2 : konversikan 1111(2) =.1000 (Grey code)

Konversi Grey code ke Biner :


caranya dengan menambahkan angka paling depan ke belakang, setelah
mendapat hasilnya ditambahkan ke belakang lagi.
contoh 1 : konversikan 1000(Grey code) =............(2)
1 exor 0 = 1
1 exor 0 = 1
1 exor 0 = 1
1 exor 0 = 1
hasil konversi 1000(Grey code) = 1111(2)
contoh 2 : konversikan 0011(Grey code) =.0010.............(2)
hasil konversi 0011(Gray code) = 0010(2)

Exercises

You should practice conversions between binary,


octal, decimal and hexadecimal.

You should be able to code decimal to BCD (and


BCD to decimal) and between binary to gray.

You should be able to explain and give examples


of digital and analogue data.

You might also like