0% found this document useful (0 votes)
53 views17 pages

Data Rep

This document discusses data representation in computers using binary and hexadecimal number systems. It explains how binary numbers are used to represent data in computers using bits and bytes. Conversion between binary and hexadecimal is demonstrated. Common character encoding standards like ASCII and Unicode are also summarized.

Uploaded by

api-3742735
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views17 pages

Data Rep

This document discusses data representation in computers using binary and hexadecimal number systems. It explains how binary numbers are used to represent data in computers using bits and bytes. Conversion between binary and hexadecimal is demonstrated. Common character encoding standards like ASCII and Unicode are also summarized.

Uploaded by

api-3742735
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

F.4 Computer and Info.

Tech.

Data Representation in Computer


Binary System
 Base-2
 Only 0 (smallest) and 1 (largest)
 Denoted by a subscript, 2
 e.g. 1011012
= 4510
Digit 1 0 1 1 0 1
Place
25 24 23 22 21 1
Value
Digit
1 x 25 0 x 24 1 x 23 1 x 22 0 x 21 1
Value
Binary System
 Properties
 Rightmost digit (Least significant digit)
 0: Even number
 1: Odd number
 100…02 = 2n
n
 111…12 = 2n - 1
n
Hexadecimal System
 Base-16
 Digits: 0 (smallest) – 9, A(10) – F(15) (largest)
 Denoted by a subscript, 16
 e.g. 89AB2
= 3524310
Digit 8 9 A B
Place
163 162 161 1
Value
Digit
8 x 163 9 x 162 10 x 161 11
Value
Binary  Hexadecimal
 Starts from the rightmost digit
 Change each nibble to one hexadecimal digit
 Or vice versa
 According to: 0000
2 0
16 1000 2 816
00012 116 10012 916
00102 216 10102 A16
00112 316 10112 B16
01002 416 11002 C16
01012 516 11012 D16
01102 616 11102 E16
01112 716 11112 F16
Binary  Hexadecimal
00002 016 10002 816
 Example 00012 116 10012 916
 Binary  Hexadecimal 00102 216 10102 A16
 1001111102 00112 316 10112 B16
01002 416 11002 C16
 =13E16 01012 516 11012 D16
 Hexadecimal  Binary 01102 616 11102 E16
 53F16 01112 716 11112 F16

 =0101001111112
Data Representation

 In computer, all data are:


 Electronic signals
 High / Low Voltages
 Represented by 0 and 1
1 0 0 1 0
 Therefore, in binary system
 However, for the sake of convenience, we, human,
sometimes use hexadecimal system instead of binary
Data Representation
 In computer
 Each binary digit represents 1 bit
 Bit = BInary digiT
 Common unit conversions:
 4 bits = 1 nibble, 8 bits = 1 Byte
 1 Kibit = 210 = 1024 bits, 1 kbit = 1000 bit
 1 Mibit = 210 Kibit, 1 Mbit = 1000 kbit
 1 Gibit = 210 Mibit, 1 Gbit = 1000 Mbit
 1 Tibit = 210 Gibit, 1 Tbit = 1000 Gbit
 Ref: http://physics.nist.gov/cuu/Units/binary.html
 Smallest data size unit: byte
Unsigned Integer

 Unsigned: Only positive numbers


 For n-digits binary unsigned integers:
 Numbers that can be represented = 2n
 Minimum = 000…02 = 010
n
 Maximum = 111…12 = 2n – 1
n

 Leading zeros are preserved!!!


 e.g. For a 8-bit system: 510 = 000001012
Unsigned Integer
 Overflow
 No. of available bits < No. of binary digits
 Leftmost (most significant) bits are dropped
 e.g. Use 10-bits unsigned integer to store 300010
 Maximum = 210 – 1 = 1023
 3000 = 2048 + 952 = 1011101110002
 3000 occupies 12 bits

 1 0 1 1 1 0 1 1 1 0 0 0 Memory

 Number stored = 11101110002 = 95210


 Trick with your calculator
Question

 How many bytes for storing 435?


 43510 = ?2
 Smallest unit of memory?
 43510 = 1101100112 (9 bits)
 However, smallest unit = 1 Byte (8 bits)
 Therefore, 2 bytes (16 bits) is needed
 In a 8-bit memory, 435 = ?
 43510 = 1101100112 (9 bits)
 43510 101100112 (8 bits) = 17910
Characters
 Characters are stored as binary data in computer
 Standard of storing characters
 For software and information to be transferable between
computers
 Character set
 Collection of characters that can be stored under certain
standard
 Common standards:
 ASCII
 Unicode
 Big-5
 GB-Code
Characters - ASCII
 American Standard Code for Information Interchange
 Most commonly used
 Only Latin-based characters
 Developer
 American National Standard Institute (ANSI)
Characters - ASCII
 7 bits to store characters
 1 bit (least significant bit) for parity
 Number of characters: 27 = 128
 48 – “0”, 57 – “9”, 65 – “A”, 90 – “Z”, 97 – “a”, 122 – “z”
 ∴ In computer, “0” < “9” < “A” < “Z” < “a” < “z”
 Extended-ASCII
 8 bits to store character
 256 characters
 From 128 – 255: non-standard characters
 Another common standard: EBCDIC
 EBCDIC = Extended Binary Coded Decimal Interchange Code
Characters - Unicode
 Includes alphabets and symbols in major languages
 Traditional and simplified Chinese are included
 Developer:
 Unicode Consortium
 Related link: www.unicode.org
 Uses 1, 2 or 4 bytes
 Unicode Lookup Page:
 http://toni.technetium.be/ascii/unicode.php
Characters – Chinese
characters
 Two major standard
 Big-5 code
 GB code (GuoBao code)
 They are Double Bytes Character Sets (DBCS)
 Big-5 Code
 Traditional Chinese
 Extension of character set:
 Hong Kong Supplementary Character Set (HKSCS)
 Big-5 Code Lookup Page:
 http://www.khngai.com/chinese/charmap/
 GB Code
 Simplified Chinese
Parity Check

 Unweighted Modulus 2
 Parity bit is put to the right
 Two types:
 Odd Parity Check
 Odd no. of 1s (including the parity bit)
 Even Parity Check
 Even no. of 1s (including the parity bit)

You might also like