© 2004, Robert K. Moniot Binary and Hex How to count like a computer.

Slides:



Advertisements
Similar presentations
Computer Science 101 RGB Color System. Simplified Introduction to Color Vision Go to How We See: The First Steps of Human Vision or Color Vision for more.
Advertisements

Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
A-Level Computing#BristolMet Session Objectives#8 express numbers in binary, octal and hexadecimal explain the use of code to represent a character set.
Data Representation Computer Organization &
Data Representation COE 205
Connecting with Computer Science, 2e
Binary Representation
Computer Arithmetic: Binary, Octal and Hexadecimal Presented by Frank H. Osborne, Ph. D. © 2005 ID 2950 Technology and the Young Child.
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
IT-101 Section 001 Lecture #4 Introduction to Information Technology.
Contains 16,777,216 Colors. My Car is red My Car is red How do I add colors to my web page? Notepad Browser Works with the “Standard” colors: Red, Green,
ENEL 111 Digital Electronics Richard Nelson G.1.29
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
© Maths Support Service 2007 Binary and Hexadecimal Numbers Next Slide AE98FD AE98FD.
Real Numbers and the Decimal Number System
Number Systems.
©Brooks/Cole, 2003 Chapter 2 Data Representation.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Computers Organization & Assembly Language
CMYK vs. RGB Design. Primary colors The colors that make up the base for every other color created. Depending on whether you are looking at it from science,
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Representing Data. Representing data u The basic unit of memory is the bit  A transistor that can hold either high or low voltage  Conceptually, a tiny.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
What are the five colors in the legend? Enter the information below (5 points) 0000FF = = FFFFFF = 00FF00 = FF0000 = Color Theory Legend: income.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Number systems Jaana Holvikivi Metropolia. Result AND OR NOT Logical operations Boolean algebra Operations &&AND.
Number Systems CIT Network Math
Hexadecimal Codes 1. RGB Color Wheel 2 Before we begin Hexadecimal is a number system Based on using 0 – F to represent 0 – 15 Hex is used to represent.
Chapter 7—Objects and Memory The Art and Science of An Introduction to Computer Science ERIC S. ROBERTS Java Objects and Memory C H A P T E R 7 Yea, from.
Logical Circuit Design Week 2,3: Fundamental Concepts in Computer Science, Binary Logic, Number Systems Mentor Hamiti, MSc Office: ,
The Hexadecimal Number System and Memory Addressing ISAT 121.
EET 250 Number systems. Introduction to Number Systems While we live in a world where the decimal number is predominant in our lives, computers and digital.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
# Red Green Blue Digital Color RGB to HEX.
CS 111 – Sept. 3 More data representation Review hex notation Text –ASCII and Unicode Sound and images Commitment: –For Wednesday: Please read pp
HEXADECIMAL NUMBERS.
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Announcements Chapter 8 for today. 2 More Digitization Light, Sound, Magic: Representing Multimedia Digitally © Lawrence Snyder, 2008.
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.
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,
ABFC... Home page Introduction Binary number system Hexadecimal number system Binary coded decimal Objectives Octal number system Click.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Fall’ 2014 Lesson - 1 Number System & Program Design CSE 101.
Base 16 (hexadecimal) Uses the decimal digits and the first letters of the alphabet to encode 4 binary bits (16=2 4 ) abcdef or ABCDEF.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Searching Binary and Hexadecimal numeral systems
Number Systems.
Hexadecimal Sweet Sixteen!.
Lec 3: Data Representation
Unit 18: Computational Thinking
ENEL 111 Digital Electronics
BINARY CODE.
Digital Electronics Jess 2008.
Information Support and Services
EPSII 59:006 Spring 2004.
Hexadecimal Binary Made Easier.
Numbering System TODAY AND TOMORROW 11th Edition
Binary Lesson 3 Hexadecimal
Binary Lesson 3 Hexadecimal
Binary Lesson 3 Hexadecimal
Chapter Four Data Representation in Computers By Bezawit E.
Chapter 2 Number Systems.
Chapter 2 Number Systems.
Binary Lesson 4 Hexadecimal and Binary Practice
Chapter 2 Number Systems.
ENEL 111 Digital Electronics
Chapter 2 Number Systems.
Digital Representation of Data
Presentation transcript:

© 2004, Robert K. Moniot Binary and Hex How to count like a computer

© 2004, Robert K. Moniot Why Binary? The basic unit of storage in a computer is the bit (binary digit), which can have one of just two values: 0 or 1. This is easier to implement in hardware than a unit that can take on 10 different values. –For instance, it can be represented by a transistor being off (0) or on (1). –Alternatively, it can be a magnetic stripe that is magnetized with North in one direction (0) or the opposite (1). Binary also has a convenient and natural association with logical values of False (0) and True (1).

© 2004, Robert K. Moniot Building on Binary Binary bits are grouped together to allow them to represent more information: –A nybble is a group of 4 bits, e.g –A byte is a group of 8 bits, e.g –A word is a larger grouping: usually 32 bits. A halfword is half as many bits as a word, thus usually 16 bits. A doubleword is twice as many bits, usually 64 bits. However, computers have been designed with various word sizes, such as 36, 48, or 60 bits. Clearly, the number of possible combinations of a group of N bits is 2 N = 2x2x2 … x2 (N 2s). Thus: –A nybble can form 2 4 =16 combinations –A byte can form 2 8 =256 combinations –A 32-bit word can form 2 32 =4,294,967,296 combinations

© 2004, Robert K. Moniot Building on Binary Each combination of a group of bits can be assigned a symbolic meaning. For instance, bytes can be used to represent text by associating each byte value with a character. For example, the ISO character encoding (an extension of the older ASCII code) assigns the value to mean a period (‘.’), to mean capital ‘A’, and so on. It is also possible to represent numbers using binary. The binary numbering system is like the decimal system, except that the only two digits used are 0 and 1, and digits are multiplied by powers of 2 instead of 10.

© 2004, Robert K. Moniot Decimal and Binary Numbers In the decimal system, each digit has a weight that is 10 times the weight of its neighbor to the right. Thus: 1234 = (((1x10 + 2)x10 + 3)x10) + 4 Similarly, in a binary number, each digit has a weight that is 2 times the weight of its neighbor to the right. Thus: 1011 = (((1x2 + 0)x2 + 1)x2 + 1 Expressing this in decimal it is ((2x2 + 1)x2 + 1 = 5x2 + 1 = 11.

© 2004, Robert K. Moniot Binary Numbers 0000 = = = = = = = = = = = = = = = = 15 Here are the first 16 binary numbers (using 4 bits), and their decimal equivalents.

© 2004, Robert K. Moniot Binary and Hexadecimal Because binary numbers are rather unwieldy, programmers prefer to use a more compact way to represent them. Historically, octal (base 8) and hexadecimal (base 16, or hex) have been used. –Octal has the advantage that it uses only familiar digits, but it groups digits by threes, which is inconvenient for word sizes that are multiples of 4. So it is seldom used nowadays. –Hexadecimal works nicely for bytes and for word sizes that are multiples of 4, but requires the introduction of 6 new digits. Conversion between binary and decimal is slow and is preferably avoided if there is no need. Octal and hex allow immediate conversion to and from binary.

© 2004, Robert K. Moniot Binary and Hexadecimal 0000 = = = = = = A 0011 = = B 0100 = = C 0101 = = D 0110 = = E 0111 = = F Hexadecimal works by grouping binary bits into groups of 4 (starting from the right). Each group (a nybble) is assigned a hex digit value. The digits are the same as for decimal up to 9, and then letters A through F are used for 10 through 15. Thus the 16-bit binary number converted to hex is B2A9

© 2004, Robert K. Moniot The RGB Color System HTML styles define only 16 colors that are guaranteed to be recognized by name. Most browsers recognize many other color names, but there is no guarantee. So many web developers use “RGB” values to define colors. RGB values are based on the Red, Green, Blue primary color system. Just about every color that the human eye can perceive can be represented by a combination of specific amounts of each primary color. To define colors numerically, each of the three primary colors is assigned a numerical strength. The three strengths of Red, Green, and Blue define the color.

© 2004, Robert K. Moniot Expressing Colors in Hex It is convenient to define the strengths of the primary colors using 8-bit numbers, or bytes. An 8-bit number can be represented using two hex digits. The value of the hex number ranges from 00 to FF, corresponding to a range from 0 to 255 decimal. A strength of 0 means the color is completely absent. A strength of FF or 255 means the color is at its maximum. An RGB color is thus represented by three 8-bit numbers, or six hex digits. In HTML, a value is signified as hexadecimal by prefixing it with a ‘#’ sign. For example, "#E703A0" would be such a value.

© 2004, Robert K. Moniot Expressing Colors in Hex Note that 40 is ¼ of full strength, 80 is ½, C0 is ¾. Here are some examples of colors expressed in hex: "#000000" Black (all colors off) "#FFFFFF" White (all colors max) "#FF0000" Red (red max, green & blue off) "#00FF00" Green "#0000FF" Blue "#FFFF00" Yellow (equal amounts of red & green) "#AEEEEE" Turquoise "#808080" Gray (all colors half max)