Bits, Nybbles, Bytes, numbers and characters

Slides:



Advertisements
Similar presentations
Information Representation
Advertisements

Representing Data, Pictures, Time, and Size in Computer
Advanced Topics Object-Oriented Programming Using C++ Second Edition 13.
Using Binary Coding Information Remember  Bit = 0 or 1, Binary Digit  Byte = the number of bits used to represent letters, numbers and special characters.
Data Representation Computer Organization &
Data Representation COE 205
Using Binary Coding Information Remember  Bit = 0 or 1, Binary Digit  Byte = the number of bits used to represent letters, numbers and special characters.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Representing Information as Bit Patterns Lecture 4 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
Data Representation (in computer system) Computer Fundamental CIM2460 Bavy LI.
CCE-EDUSAT SESSION FOR COMPUTER FUNDAMENTALS Date: Session III Topic: Number Systems Faculty: Anita Kanavalli Department of CSE M S Ramaiah.
COMPUTER FUNDAMENTALS David Samuel Bhatti
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
©Brooks/Cole, 2003 Chapter 2 Data Representation.
Chapter 2 Data Representation. Define data types. Visualize how data are stored inside a computer. Understand the differences between text, numbers, images,
Cosc175/data1 Data comprised of constants and variables information stored in memory Each memory location has an address Address - number identifying a.
Binary Numbers and ASCII and EDCDIC Mrs. Cueni. Data Representation  Human speech is analog because it uses continuous signals (waves) that vary in strength.
Agenda Data Representation – Characters Encoding Schemes ASCII
Bits & Bytes: How Computers Represent Data
Computer System Basics 1 Number Systems & Text Representation Computer Forensics BACS 371.
CSC 101 Introduction to Computing Lecture 9 Dr. Iftikhar Azim Niaz 1.
Computers Organization & Assembly Language
CPS120: Introduction to Computer Science
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
Eng.Samra Essalaimeh Philadelphia University 2013/ nd Semester PIC Microcontrollers.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems Spring Semester 2013Programming and Data Structure1.
Cis303a_chapt03-2a.ppt Range Overflow Fixed length of bits to hold numeric data Can hold a maximum positive number (unsigned) X X X X X X X X X X X X X.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Data Representation, Number Systems and Base Conversions
DATA REPRESENTATION CHAPTER DATA TYPES Different types of data (Fig. 2.1) The computer industry uses the term “MULTIMEDIA” to define information.
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
Business Programming I Fall – 2000 By Jim Payne Lecture 05Jim Payne - University of Tulsa2 Alphanumeric Storage Numbers that are not numbers? Alphabetic.
Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
DATA REPRESENTATION 4 Y. Colette Lemard February 2009.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY.
23/07/2016CSE1303 Part B lecture notes 1 Introduction to computer systems Lecture B01 Lecture notes section B01.
1.4 Representation of data in computer systems Character.
Introduction to computer science Lec2 cs111. Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8- bit character encoding used mainly on.
Lecture Coding Schemes. Representing Data English language uses 26 symbols to represent an idea Different sets of bit patterns have been designed to represent.
Computer Organization Exam Review CS345 David Monismith.
A LECTURE NOTE. Introduction to Programming languages.
Programming and Data Structure
Data Representation ICS 233
Lec 3: Data Representation
Binary Numbers and ASCII and EDCDIC
Number Representation
Data Representation Binary Numbers Binary Addition
Bits & Bytes How Computers Represent Data
Microprocessor Systems Design I
EPSII 59:006 Spring 2004.
Data Encoding Characters.
TOPICS Information Representation Characters and Images
Ch2: Data Representation
Dr. Clincy Professor of CS
Presenting information as bit patterns
COMS 161 Introduction to Computing
Chapter 2 Data Representation.
Bits and Bytes Topics Representing information as bits
COMS 161 Introduction to Computing
How Computers Store Data
Comp Org & Assembly Lang
Dr. Clincy Professor of CS
Presentation transcript:

Bits, Nybbles, Bytes, numbers and characters Brian Mapes MPO581 Jan 24, 2011 from googling and poaching

Data Types bit - a 0 or 1. Can represent 2 unique values byte - 8 bits. 256 values -128 to 128 unsigned byte - 8 bits 0 to 256 character – an alphabet-mapped byte short int - 16 bits -32767 to 32767 long int – 32 bits 4,294,967,296 values float - 32 bits coded: mantissa,exp double - 64 bits coded word – machine dependent. 32 or 64 bits

Binary Equivalents of Decimal Numbers Decimal Binary (LR) Binary (R L) 0 0000 0000 1 0001 1000 2 0010 0100 3 0011 1100 4 0100 etc. 5 0101 6 0100 7 0111 8 1000 Is “most significant bit” (MSB) at “right” or “left”? (right and left are arbitraryin computer chip memory space)

Powers of 2 Decimal Decimal 20 1 28 256 21 2 29 512 22 4 210 1024 20 1 28 256 21 2 29 512 22 4 210 1024 23 8 211 2048 24 16 212 4096 25 32 213 8192 26 64 214 16384 27 128 215 32768

Decimal (base 10) numbers A decimal number can be represented as the sum of powers of 10 (the base) with coefficients in the base 10 alphabet (0 - 9) For example: 2485 = 2000 + 400 + 80 + 5 2485 = 2 * 1000 + 4 * 100 + 8 * 10 + 5 * 1 2485 = 2 * 103 + 4 * 102 + 8 * 101 + 5 * 100 Same principle can be applied in binary...

Hexadecimal Numbers (nybbles or half-bytes) 4 bits  Base-16 number system Uses digits 0 - 9 and letters A - F One hexadecimal digit can express values from 0 to 15 For example: C represents 12 (Not important for us - Used in memory addressing, sometimes wifi passwords,...)

Hexadecimal - Binary Equivalents Hex Binary Hex Binary 0 0000 8 1000 1 0001 9 1001 2 0010 A 1010 3 0011 B 1011 4 0100 C 1100 5 0101 D 1101 6 0110 E 1110 7 0111 F 1111

Characters and strings EBCDIC, Extended Binary Coded Decimal Interchange Code Used by IBM in mainframes (360 architecture and descendants). Earliest system ASCII, American Standard Code for Information Interchange. Most common system Unicode, http://www.unicode.org New international standard Variable length encoding scheme with either 8- or 16-bit minimum “a unique number for every character, no matter what the platform, no matter what the program, no matter what the language.” EBCDIC - 8 bit ASCII - 7 bit, 128 characters EBCDIC - Extended Binary Coded Decimal Interchange Code Unicode - uses a default 16-bit encoding, but includes extensions that permit over 900,000 additional characters. It offers two Unicode Transformation Formats, UTF-8 and UTF-16, variable length encoding schemes with, respectively, 8- and 16-bit minimum length codes. UTF-8 is compatible with ASCII. CSE360

The Unicode Character Set Each character stored as 16-bits Maximum number of characters that can be represented: 65,536 (216) ASCII character set (used by many programming languages) stores each character as 7 bits (maximum number of characters is 128). For compatibility, first 128 characters of Unicode set represent the ASCII characters

Some Unicode Characters Unicode Character Decimal Value * 42 1 49 2 50 A 65 B 66 a 97 b 98 } 125

Bytes as the “element” of data Memory: Can be viewed as an array of storage elements. The index of each element is called the address. Each element holds the same number of bits. How many bits per element? 8, 16, 32, 64? 8 (Byte) is typical Words are about the processor: how many bytes are loaded into a register and processed at once? 32-bit word common, 64-bit  faster double math 1 2 ... n-1 8 bits = 1 byte 16 bits 32 bits 64 bits It is not the size of the addressable element that depends on the size of the data bus, but, rather, the size of the word. The number of addressable elements depends on the size of the address bus. SPARC has a 32 bit word; a word is not always 32 bits. Mention the phrase “?-bit addressable”. SPARC’s memory is 8-bit addressable, i.e., byte addressable.

Single precision

Charles Babbage 1791-1871 Lucasian Professor of Mathematics, Cambridge University, 1827-1839 1/20/2009 CS152-Spring’09 CS252 S05

The first programmer Ada Byron aka “Lady Lovelace” 1815-52 Ada’s tutor was Babbage himself! 1/20/2009 CS152-Spring’09 CS252 S05

Babbage’s Influence Babbage’s ideas had great influence later primarily because of Luigi Menabrea, who published notes of Babbage’s lectures in Italy Lady Lovelace, who translated Menabrea’s notes in English and thoroughly expanded them. “... Analytic Engine weaves algebraic patterns....” In the early twentieth century - the focus shifted to analog computers but Harvard Mark I built in 1944 is very close in spirit to the Analytic Engine. 1/20/2009 CS152-Spring’09 CS252 S05

A Hierarchy of Languages Application Programs High-Level Languages Assembly Language Machine Language Hardware High-Level Language Low-Level Language Machine independent Machine specific

Bit depths in color 16 bits per pixel (high color) 5 bits for red, 5/6 bits for green, 5 bits for blue potential of 32 reds, 32/64 green, 32 blues total colors: 65536 32 bits per pixel (true color) 8 bits for red, green, blue, and alpha potential for 256 reds, greens, and blues total colors: 16777216 (more than the eye can distinguish)