Tahun : 2006
Versi : 1/0
Pertemuan 02
Computer Data Format
1
Learning Outcomes
2
Outline Materi
• Sistem Bilangan
• Konversi antar Sistem Bilangan
• Format Data
3
4
Sistem Bilangan Desimal dan Biner
5
Sistem Bilangan
6
Biner
7
Octal
8
Desimal
9
Hexadesimal
10
Dasarnya: Desimal Desimal
11
Konversi Bilangan
• Desimal Desimal
• Biner Desimal
12
Biner Desimal
13
Biner Desimal
14
Desimal Biner
15
Octal Desimal
16
17
Hexadesimal Desimal
18
Hexadesimal Desimal
19
Hexadesimal Desimal
20
Hexadesimal Biner
21
Floating Point
23
Computer Data Format
• Alphanumerik
– ASCII
– EBCDIC
• BCD
– Standard BCD
• Packed
• Unpacked
– Gray Code
• Sign dan Unsigned
24
ASCII
ASCII is the most widely used coding system for
alphanumeric characters. The name stands for
the American Standard Code for Information
Interchange.
ASCII characters use 7 bits to encode, upper case
letters, lower case letters, digits, and common
punctuation marks. The first 32 characters are
used for non printable characters, for example
carriage return, line feed, tab, ESC,
acknowledge, negative acknowledgement, etc.
Kunjungi http://www.asciitable.com 25
ASCII
26
EBCDIC
28
BCD: Packed dan UnPacked
29
Gray Code
• Definition: An ordering of 2n binary numbers such that only
one bit changes from one entry to the next.
• Gray code termasuk dalamkelas kode yang mempunyai
perubahan minimum, dimana hanya 1 bit dalam grup kode
yang berubah ketika bergerak dari langkahyang satu ke
langkah yang berikutnya. Gray code biasa digunakan dalam
situasi dimana kode-kode lain seperti biner dapat
menghasilkan error atau hasil yang meragukan, selama
masa perubahan dimana lebih dari 1 bit dari kode tersebut
yang berubah.
• Gray codes are useful in mechanical encoders since a slight
change in location only affects one bit. Using a typical binary
code, up to n bits could change, and slight misalignments
between reading elements could cause wildly incorrect
readings
• Gray code (http://www.nist.gov/dads/HTML/graycode.html)
30
31
http://www.ida.net/users/tetonsl/railroad/graycode.htm
32
Signed dan Unsigned
• MSB (Most Significant Bit) digunakan sebagai penanda
negative dimana 0 merupakan possitive number, dan 1
adalah negative number.
• Ada 2 cara merepresentasikan bilangan negative:
– Sign & Magnitude, dimana MSB (Most Significant Bit) merupakan
penandanya dan value-nya didapat dari magnitude-nya.
• Kelemahan sistem ini, adalah operasi aritmatik tidak bisa dilakukan
terhadap binary ini (karena misalkan binary signed 4 bit, sebenarnya
value hanya direpresentasikan oleh 3 bit terakhir dan bit MSB sebagai
sign saja). Dengan 4 bit, data memiliki range dari -7 hingga +7.
33
Two Complement
34