12.1.1.1 convert binary numbers to hexadecimal 12.1.1.2 explain the advantages of using hexadecimal numbers in computer systems Binary, hexadecimal numbers The binary number system If in the decimal system, the numbers can be represented by ten digits 0-9, for example, 250; 897; 110, etc, To better understand the simplicity of the binary number system, it is best to examine how our familiar decimal number system works. Columns, right-to-left, represent units, tens and hundreds, etc.
The principle is exactly the same in the binary number system. As we move from right to left, each digit is worth twice as much as the previous one, instead of ten times as much.
The minimum and maximum values that can be represented using unsigned binary for n bits are 0 and 2n-1 respectively. Converting from decimal to binary To convert a decimal number to binary, first write headings from right to left of 1, 2, 4, 8 ... 128. (If the number given is greater than 255, continue writing headings). Any decimal number can be represented as the sum of powers of two. The power of two that we use is denoted 1, if not, we denote 0. For example, the number 105 consists of powers of two such as 64 + 32 + 8 + 1 (look at the table below)
The hexadecimal number system The hexadecimal system, often referred to as simply 'hex', uses a base of 16 as follows:
Converting from binary to hexadecimal and vice versa To convert a binary number to hexadecimal, split the binary number into groups of 4 binary digits (nibble) from right to left. For example, convert binary number 10 1101 0011 1010 to hex.
The advantages of using hexadecimal numbers in computer systems The main reason that hexadecimal numbers are used is because it is much easier to express binary number representations in hex than it is in any other base number system. Although computers do not use hex, it is easier for humans to remember and express binary numbers in hex. A two-digit hex number can represent a byte. To determine memory location. Hexadecimal can characterize every byte as two hexadecimal digits only compared to eight digits when using binary. To define colors on web pages and in programming languages (eg. Python). Each primary color – red, green, and blue is characterized by two hexadecimal digits. The format being used is #RRGGBB. RR stands for red, GG stands for green and BB stands for blue. To represent MAC addresses. Media Access Control addresses consist of 12-digit hexadecimal numbers. For example, 00:A0:C9:14:C8:29 To display error messages. Hexadecimal are used to define the memory location of the error. This is useful for programmers in finding and fixing errors. Questions: 1. How many digits are used in decimal, binary, and hexadecimal? 2. What is the difference between decimal, binary, and hexadecimal? 3. Imagine people with 10 eyes, 10 legs, 10 hands, and 100000 teeth. How is this possible? 4. Explain what nibble is. Exercises: Ex. 1 Matching hex and nibble. Ex. 2 Fill the gaps and write down your decision to copybook. Ex. 3 Distribute numbers according to number systems with minimal base. Ex. 4 Decode the hidden message Exam questions: Question. Explain why hexadecimal numbers are often used to represent binary numbers.(Marks: 2)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Просмотров: 5342 | | |
Всего комментариев: 0 | |