0% found this document useful (0 votes)
22 views47 pages

Week1 Lecture Chapter1

This document outlines the course objectives and content for Principles of Computer and Composition. It covers numeric and non-numeric data representation, including number systems like binary, octal, hexadecimal and conversions between them. It also discusses ASCII encoding for text representation. Finally, it describes basic arithmetic and logical operations on binary data like addition, subtraction, multiplication and division.

Uploaded by

CST2109168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views47 pages

Week1 Lecture Chapter1

This document outlines the course objectives and content for Principles of Computer and Composition. It covers numeric and non-numeric data representation, including number systems like binary, octal, hexadecimal and conversions between them. It also discusses ASCII encoding for text representation. Finally, it describes basic arithmetic and logical operations on binary data like addition, subtraction, multiplication and division.

Uploaded by

CST2109168
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 47

PRINCIPLES OF COMPUTER AND

COMPOSITION

Course Information

Dr. Yiju Wang


School of Aerospace and Engineering, Xiamen University
wangyiju@xmu.edu.my
Office: A1-425
CHAPTER 1

DATA REPRESENTATION AND MANIPULATION


Objectives
3

 Master the mathematic foundation of CST301


 Numeric data representation
 Non-numeric data representation
 Basic arithmetic and Logic operations
Chapter1 Data Representation and Manipulation
4

 1.1 Numeric data representation


 1.2 Non-numeric data representation
 1.3 Basic arithmetic and Logic operations
Chapter1 Data Representation and Manipulation
5

 1.1 Numeric data representation


 1.1.1 Number System
 1.1.1.1 Decimal Number
 1.1.1.2 Binary Number
 1.1.1.3 Octal Number
 1.1.1.4 Hexadecimal Number
 1.1.2 Number Conversion
 1.1.2.1 Conversions to Decimal Numbers
 1.1.2.2 Conversions from Decimal Numbers
 1.1.2.3 Conversion between Hexadecimal and binary numbers
 1.2 Non-numeric data representation
 1.2.1 BCD(Binary Coded Decimal) Code
 1.2.2 ASCII code
 1.3 Basic arithmetic operations
 1.3.1 Operation of Binary
 1.3.2 Integer Formats in Microcomputers
1.1.1 Number System
6

 1.1.1.1 Decimal Number


 1.1.1.2 Binary Number
 1.1.1.3 Octal Number
 1.1.1.4 Hexadecimal Number
1.1 Number System
7

 To avoid confusion, we put postfix or subscript to


indicate the number system.
1.1.1.1 Decimal Number
8

 Base or radix is 10
 Ten characters(0, 1, 2, 3, 4, 5, 6, 7, 8, 9 )
 The weights are powers of 10.

n
XnXn- 1…X1X0X- 1…X- m = 
im
X i  10 i
1.1.1.1 Decimal Number
9

n
XnXn- 1…X1X0X- 1…X- m = 
im
X i  10 i
1.1.1.1 Decimal Number
10

 “LSB” (Least Significant Bit)


 “MSB” (Most Significant Bit).
1.1.1.2 Binary Number
11

 Base or radix is 2
 Two characters(0, 1)
 The weights are powers of 2.
1.1.1.2 Binary Number
12
1.1.1.3 Octal Number
13

 Base or radix is 8
 Eight characters(0, 1, 2, 3, 4, 5, 6, 7)
 The weights are powers of 8.
1.1.1.3 Octal Number
14
1.1.1.4 Hexadecimal Number
15

 Base or radix is 16
 Sixteen characters(0, 1, 2, 3, 4, 5, 6,
7,8,9,A,B,C,D,E,F)
 The weights are powers of 16.
1.1.1.4 Hexadecimal Number
16
1.1.2 Number Conversion
17

 1.1.2.1 Conversions to Decimal Numbers


 1.1.2.2 Conversions from Decimal Numbers
 1.1.2.3 Conversion between Hexadecimal and
binary numbers
1.1.2.1 Conversions to Decimal Numbers
18
1.1.2.1 Conversions to Decimal Numbers
19
1.1.2.1 Conversions to Decimal Numbers
20
1.1.2.1 Conversions to Decimal Numbers
21
1.1.2.2 Conversions from Decimal Numbers
22

 Integral part:
 Step 1: Divide the decimal number by the radix
(number base).
 Step 2: Save the remainder (first remainder is the least
significant digit).
 Step 3: Repeat steps 1 and 2 until the quotient is zero.
1.1.2.2 Conversions from Decimal Numbers
23
1.1.2.2 Conversions from Decimal Numbers
24
1.1.2.2 Conversions from Decimal Numbers
25
1.1.2.3 Conversion between Hexadecimal
and binary numbers
26
27
1.1.2.3 Conversion between Hexadecimal
and binary numbers
28

 From binary to hexadecimal number forms.


 Separate into groups.
 Keep each group with 4 bits.
 If the last group has less than 4 bits, add 0.
1.1.2.3 Conversion between Hexadecimal
and binary numbers
29
1.1.2.3 Conversion between Hexadecimal
and binary numbers
30

 From hexadecimal to binary number forms.


 Each hexadecimal digit is replaced by its equivalent 4-
bit binary number
1.3 BCD(Binary Coded Decimal) Code
31

 The range of a BCD digit extends from 0000B to


1001B, or 0-9 decimal.
 Packed BCD data
 stored as two digits per byte
 used for some of the instructions
 Unpacked BCD data
 stored as one digit per byte.
 returned from a keypad or keyboard.
1.2 Non-numeric data representation
32

 1.2.1 BCD(Binary Coded Decimal) Code


 1.2.2 ASCII code
1.2.1 BCD(Binary Coded Decimal) Code
33
1.2.1 BCD(Binary Coded Decimal) Code
34
1.2.2 ASCII code
35

 ASCII(American Standard Code for Information


Interchange) data represent alphanumeric
characters in the memory of a computer system.
1.2.2 ASCII code
36
1.4 ASCII code
37

nul—Null sub—Substitute Character


soh—Start of Heading esc—Escape
stx—Start of Text fs—File Separator
etx—End of Text gs—Group Separator
eot—End of Transmission rs—Record Separator
enq—Enquiry us—Unit Separator
ack—Acknowledge sp—Space
bel—Bell dc1—Device Control 1
bs—Backspace dc2—Device Control 2
ht—Horizontal Tabulation dc3—Device Control 3
Lf—Line Feed dc4—Device Control 4
vt—Vertical Tabulation nak—Negative Acknowledge
ff—Form Feed syn—Synchronization
cr—Carriage Return etb—End of Transmission Block
so—Shift Out can—Cancel
si—Shift In em—End of Medium
dle—Data Link Escape
1.2.2 ASCII code
38

 0-9, 30H-39H
 A-Z, 41H-5AH
 a-z, 61H-7AH
1.3 Basic arithmetic operations
39

 1.3.1 Operation of Binary


 1.3.2 Integer Formats in Microcomputers
1.3.1 Operation of Binary
40

 Arithmetic Operation
1.3.1 Operation of Binary
41

 Binary addition
1.3.1 Operation of Binary
42

 Binary subtraction
1.3.1 Operation of Binary
43

 Binary multiplication
1.3.1 Operation of Binary
44

 Binary division
1.3.1 Operation of Binary
45

 Logical operation
1.3.1 Operation of Binary
46

 Gates
1.3.1 Operation of Binary
47

 Bit(0 or 1)
 Byte(8 bits)
 Word(16 bits)
 Double word(32 bits).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy