|The Decimal system,||The Octal system,||Hexadecimal,||The Binary system|
|The relationship between Hex, Octal and Binary||Converting from Decimal to Hex, Octal, and Binary|
|The principle operations of the computer - Adding bits, Comparing bits, Moving bits|
|Subtraction - 2's Complement||Some questions|
Normally, we count in 10s.
This is the Decimal system,
called the Denary system
The system can be visualised as columns, or placings for digits representing particular values.
|For example, in Decimal:||
The Octal system is based
Again we can visualise the system as columns. However, in the octal system only the digits 0 to 7 may appear in the columns. (The highest possible value in any column is 7, because when we reach 8 in a column we carry 1 to the next left-hand column. In this system, the digits 8 and 9 cannot be used.)
|For example: in Octal||
|In the Hexadecimal system:
the letter A is used to represent 10. Then B = 11, C = 12, D = 13, E = 14 and F = 15.
|For example: in Hex||
In the case of translating to Octal one must be
able to count up to 7 in binary; i.e. in the example above one needs
to know that 011 in binary = 3 decimal, that binary 111 = 7decimal,
and that binary 010 = 2 in decimal.
Similarly, to write binary as hex, one only needs to know how to count up to 15 in binary.
If you had to write machine code which would you use? Binary, Octal or Hex?
|Converting decimal 2002 into binary
||Converting decimal 159 into binary
|Converting decimal 2002 into octal and hex
|0 + 0 = 0||0 + 1 = 1||1 + 1 = 0 (carry 1)|
(see also 'How a computer adds' for some diagrams illustrating the mechanics of the operation)
|0 = 0 ? result is 1||0 = 1 ? result is 0||1 = 1 ? result is 1|
When 2 bits are compared the answer is always a bit (a 1 or a 0). This ability to compare bits allows us to use computers to perform logical operations.
There are two type of movement: (a) from one part of memory to another;
and (b) a shift.
It is the second form of move, the 'shift' which is of interest to us here. For example:
if the computer has the following binary number stored in memory:
Shifting bits leftwards supports
very fast even-number multiplication.
Shifting bits plus adding bits provides odd-number multiplication.
Shifting bits rightwards provides division.
taking the number 42 as a starting point:
It is a curious fact that a computer subtracts using addition. First
method known as 2's Complement
used to create a negative representation
of the number to be subtracted..
Then subtraction is a matter of adding the negative number to the number from which it is being subtracted. (!)
See 2's Complement
Conventionally we usually talk in terms of bytes - or collections of 8 bits. This allows a variety of items to be transmitted. For example, the most common way of representing alphabetical text inside a computer is through the use of ASCII codes. Every character on a conventional keyboard has a code which is an 8-bit number (a byte).
Why do we use that particular number of bits? We need to be certain that we have enough variety in the codes to be able to cope with all the possible characters. (Note that itís necessary to keep the number of bits in powers of two.)
1. If we have 8-bit binary
numbers, what is the maximum number of codes available?
2. Is this number enough to cope with the total number of characters on the keyboard?
3. Would 4-bit numbers be enough to cope with the total number of characters on the keyboard?
If each machine cycle (instruction to the CPU) needs a byte when text is dealt with, what happens if the amount of information increases? e.g. What about non-text information?
Much of what is displayed by computers today is in the form of images, or other forms of output such as sound. What does this do to the amount of digital data that must be transferred? (Or, to put it another way, why are graphics so much harder to download on the World Wide Web than text?) To illustrate:
4. A screen display allows
64 colours with 8 levels of brightness.
i) How many items of information must the CPU be able to cope with so that all colours and levels of brightness are available?
ii) What size of binary number will the CPU need to be able to handle so that all colours and levels of brightness are available? (i.e. what's the answer to the above question in binary?)
iii) If the number of colours is reduced to 50, would that reduce the size of the binary numbers the CPU needs to cope with?
(Note - conventional screen displays now allow for at least 256 colours.)
iv) If we use a 6 digit hex code to provide a numbering system for colours, how many colours could be identified using that code?
(Actually, a 6 digit hex code is commonly used to identify colours. See some examples.)
5. What about sound? What kinds
of variation would be needed to output music?
|Tony's Home Page|