John Crisp - Introduction to Microprocessors and Microcontrollers
Здесь есть возможность читать онлайн «John Crisp - Introduction to Microprocessors and Microcontrollers» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Год выпуска: 2004, ISBN: 2004, Издательство: Elsevier, Жанр: Компьютерное железо, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Introduction to Microprocessors and Microcontrollers
- Автор:
- Издательство:Elsevier
- Жанр:
- Год:2004
- ISBN:0-7506-5989-0
- Рейтинг книги:3 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 60
- 1
- 2
- 3
- 4
- 5
Introduction to Microprocessors and Microcontrollers: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Introduction to Microprocessors and Microcontrollers»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Introduction to Microprocessors and Microcontrollers — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Introduction to Microprocessors and Microcontrollers», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
This is just the reverse of the last process. Simply take each hex number and express it as a four bit binary number.
As we saw in the last section, a four-bit number has column header values of 8, 4, 2 and 1, so conversion is just a matter of using these values to build up the required value. All columns used are given a value of 1 in binary and all unused columns are left as zero. When you are converting small numbers like 3H we must remember to add zeros on the left-hand side to make sure that each hex digit becomes a group of four bits.
Imagine that we would like to convert 5H to binary. Looking at the column header values of 8, 4, 2 and 1, how can we make the value 5?
The answer is to add a 4 and a 1. Taking each column in turn: we do not need to use an 8 so the first column is a 0. We do want a 4 so this is selected by putting a 1 in this column, no 2 so make this 0 and finally put a 1 in the last column to select the value of 1. The 5H is converted to 0101 2. All values between 0 and FH are converted in a similar way.
Example
Convert 2F6CH to binary
Step 1 Write the whole hex number out with enough space to be able to put the binary figures underneath
2 F 6 C
Step 2 Put the column header values below each hex digit
2 | F | 6 | C |
---|---|---|---|
8421 | 8421 | 8421 | 8421 |
Step 3 The hex C is 12 10that can be made of 8+4 so we put a binary 1 in the 8 and the 4 columns. The four-bit number is now 1100 2
2 | F | 6 | C |
---|---|---|---|
8421 | 8421 | 8421 | 8421 |
1100 |
Step 4 Now do the same for the next column. The hex number is 6, which is made of 4+2, which are the middle two columns. This will result in the binary group 0110 2
2 | F | 6 | C |
---|---|---|---|
8421 | 8421 | 8421 | 8421 |
0110 | 1100 |
Step 5 Since 8+4+2+1 = 15, the hex F will become 1111 2
2 | F | 6 | C |
---|---|---|---|
8421 | 8421 | 8421 | 8421 |
1111 | 0110 | 1100 |
Step 6 Finally, the last digit is 2 and since this corresponds to the value of the second column it will be written as 0010 2
2 | F | 6 | C |
---|---|---|---|
8421 | 8421 | 8421 | 8421 |
0010 | 1111 | 0110 | 1100 |
The final result is 2F6CH = 0010111101101100 2. But do we include the two leading zeros? There are two answers, ‘yes’ and ‘no’ but that’s not very helpful. We need to ask another question: why did we do the conversion? were we doing math or microprocessors? If we were working on a microprocessor system then the resulting 16 bits would represent 16 voltages being carried on 16 wires. As the numbers change, all the wires must be able to switch between 0 V and 3.3 V for binary levels 0 and 1. This means, of course, that all 16 wires must present so we should include the binary levels on all of them.
If the conversion was purely mathematical, then since leading (lefthand end) zeros have no mathematical value there is no point in including them in the answer.
Method
1 Write down the hex number but make it well spaced.
2 Using the column header values of 8, 4, 2 and 1, convert each hex number to a four bit binary number.
3 Add leading zeros to ensure that every hex digit is represented by four bits.
Example
Convert 1E08BH to binary
Step 1
1 | E | 0 | 8 | B |
---|---|---|---|---|
8421 | 8421 | 8421 | 8421 | 8421 |
Step 2
0001 1110 0000 1000 1011
So, 1E08BH = 00011110000010001011 2.
Using stepping stones
It is fairly easy to convert binary to hex and hex to binary. I find it much easier to multiply and divide by 2 rather than by 16, so when faced with changing hex into denary and denary into hex I often change them into binary first. It is a longer route but at least I can do it without my calculator (see Figure 3.2).
Figure 3.2 A longer route may prove easier
Octal is another number system which has no advantages over hex but is still met from time to time. Only a brief look will be offered here just to make sure that we have at least mentioned it.
In hex, we used binary bits in groups of four because 1111 2adds up to 15 which is the value of the highest digit (F) in hex. In octal, we use groups of three bits. The highest value is now 111 2which is 7. Octal therefore has eight digits and counts from 0 to 7. The count proceeds:
0
1
2
3
4
5
6
7
There is no 8th digit so reset the count to 0 and put a 1 in the next column.
10
11
12
13
14
15
16
17
Now go straight to 20
20
etc.
No letters are involved and it is often not recognized as octal until we realize that none of the numbers involve the digits 8 or 9.
Conversions follow the same patterns as we have seen for hex.
Octal to denary: the column heading values are 8 4, 8 3, 8 2, 8 1, 8 0.
Denary to octal: divide by 8 and write down the remainder then read remainders from the bottom upwards. Use the subscript 8 to indicate an octal number, e.g. 64 10=100 8.
Octal to binary: write each octal digit down as a three digit binary group.
Binary to octal: start from the right-hand side and chop the binary numbers into groups of three, then evaluate each group.
I think that is enough for octal. It’s (fairly) unlikely you will meet it again so we can say ‘goodbye Octal’.
In each case, choose the best option.
1 Which of these represents the largest number?
(a) 1000 8
(b) 1000 10
(c) 1000 2
(d) 1000H
2 The number CD02H is equal to:
(a) 52482 10
(b) 54228 10
(c) 56322 10
(d) 52842 10
3 The base of a number system is:
(a) always the same as the highest digit used in the system.
(b) usually +5 or +3.3.
(c) equal to the number of different digits used in the system.
(d) one less than the highest single digit number in the system.
4 Which of these numbers is the same as 10110111010 2:
(a) 1646 10
(b) 5BA 16
(c) AB5H
(d) B72h
5 The number of digits in a denary number is often:
(a) more than the number of digits in the equivalent binary number.
(b) less than or equal to the number of digits in the equivalent hex number.
(c) more than the number of digits in the equivalent hex number.
(d) more than the number of digits in the equivalent decimal number.
4. How micros calculate
In the last chapter, we saw how numbers could be represented in binary and hex forms. Whether we think of a number as hex or binary or indeed denary, inside the microprocessor it is only binary. The whole concept of hex is just to make life easier for us.
We may sit at a keyboard and enter a hex (or denary) number but the first job of any microprocessor-based system is to convert it to binary. All the arithmetic is done in binary and its last job is to convert it back to hex (or denary) just to keep us smiling.
Читать дальшеИнтервал:
Закладка:
Похожие книги на «Introduction to Microprocessors and Microcontrollers»
Представляем Вашему вниманию похожие книги на «Introduction to Microprocessors and Microcontrollers» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Introduction to Microprocessors and Microcontrollers» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.