Titlebar
Home FAQ and Resources Unit F451 Computer
Fundamentals

Unit F452 Programming
Techniques and logical Methods

Unit F453 Advanced
Computer Theory
Unit F454 Computing
Project


F451 Computer fundamentals

F451 Tests and challenges

3.1.1 Components
   - Basic definitions
   - Purpose of I/O & storage
     devices
   - Systems software and
     Applications packages
 
3.1.2 Software
   - Systems life cycle
   - Problem definition
   - Feasibility study
   - Information requirements
   - Systems analysis
   - Design specification
   - Evaluation
   - Documentation
   - Testing and installation
   - Maintenance
   - Prototyping
   - Spiral and waterfall models
   - Common applications
   - Generic applications
   - Custom-written applications
   - Knowledge-based systems
   - Operating systems
   - Different types of O/S
   - Batch v real-time processing
   - Types of user interfaces
   - Good interface design
   - Utility programs

3.1.3 Data
   - Binary, BCD, Oct and Hex
   - 2s complement and Sign
     and magnitude
   - Binary arithmetic
   - Code and character sets
   - Gathering and inputting data
   - Validation and verification
   - Different forms of output
   - Backing up v archiving data

3.1.4 Hardware
   - The CPU
   - Registers
   - Buses
   - Connectivity
   - Primary memory
   - Secondary storage
   - Transfer of data
   - Common peripheral devices
   - Justifing peripherals

3.1.5 Data transmission
   - LANs and WANs
   - LANs and WAN hardware
   - Data transmission
   - Bit rates
   - Errors in data transmission
   - Packet v circuit switching
   - Packet / circuit switching use
   - Protocols
   - Communication
   - Physical & logical protocols

3.1.6 Implications
   - Trends
   - Changes in society
   - Privacy and confidentiality
   - Legislation

 


 





3.1.3 a - Binary, BCD, Oct and Hex numbers

Introduction
We have already seen in an earlier chapter that the common numbering system we use in our daily lives is called the 'denary' system, or counting using 'base 10'. In practice, what this means is that we count using 10 different digits: 0,1,2,3,4,5,6,7,8 and 9. We have also seen that it isn't just a digit that is important. It is the position of the digit relative to the other digits in a number that is also important. For example, consider the digit 6. It is worth one amount if it is on its own. It is worth a different amount in 63, and worth a lot more in 6324, and a lot less in 54.68. In all these examples, the amount that the digit is worth is determined by where exactly it is in relation to the other digits in the number.

Let's look at a number, for example 658, and remind ourselves what we said in a previous chapter. How do we know how much this number is 'worth'? We know because without thinking about it, we judge the digits that make up the number relative to the other digits! When you were at primary school, you may have been helped to learn your numbers by writing down column headings for a particular number, just so you could get used to the idea that position is important. For example, consider what the number 658 means.

a

Of course, when you are working doing maths you (probably) don't write down the headings anymore. You don't need to because you're so used to counting in base 10. Until you are experts in the other counting systems you need to look at, you should get into the habit of writing down the 'worth' of each position.

The binary number system
Computers make heavy use of the binary counting system. The reason for this is that the electronic circuits that make up a computer are essentially made up of millions and millions of switches. The switches can have two states - on or off. The actual position of any particular switch relative to other switches is also very important. (In fact, a switch can have three states: on, off and ‘not connected’, but that is beyond this book)!

The base 10 system (denary) uses 10 digits, zero to nine. The base 2 system (binary) uses just 2 digits (or 'bits') zero and one. We are going to start our work by using groups of 8 bits, known as a ‘byte’.

Here is one possible allocation of the 'worth' of each bit in my byte.

b

It is not just whether a bit is a one or a zero that is important. The position of the bit in the whole byte is also important. The bit on the left is 'worth' far more than the bit on the right, for example. This is for no other reason than it is the way I have defined it.

Incidentally, you can see when I used the denary system, there was a pattern to working out the 'worth' of each position. It went 103, 102, 101, 100 and so on. (Any number to the power of zero is one)! There is a similar pattern when using base 2.

c

An example of using the binary system
Imagine I want to keep a record of the score of one set of throws in a darts match! The minimum score we need to hold is zero. The maximum is 180, and the score will always be an integer, a whole number i.e. you cannot score 34.5, for example. So now, to represent 180, I would set the bits as shown on the next page. (Note: when I talk about 'setting a bit' I mean that it is made a 'one'. When I talk about resetting a bit, it is made a 'zero').

d

Incidentally, the maximum number that I can represent using my system is 255. I don't need numbers this high for my darts score, but it is always nice to know what the maximum number you can store is. This is shown next.

e

It's also nice to know what the smallest number is using any number system. The smallest number you can represent here is zero. How you do this is shown below.

f

So with this numbering system I can represent any whole number from zero to 255.

Q1. Represent the denary numbers 10, 31 and 250 in binary using one byte.
Q2. What is the denary equivalent of these binary numbers: 00000100, 10101010, 10000001
Q3. Suppose I needed to store 5 numbers, each being an individual digit. How many bytes would I need?
Q4. How many bits are there in 7 bytes?
Q5. What is the maximum and minimum numbers I can represent using one byte?

Computers are digital devices! If we had to work in binary all the time, we would soon go mad! The numbers are very long. It takes a while to work them out and it isn't very convenient. There are other numbering systems around that, because of their very close relationship with binary, make them highly suitable. Programmers will sometimes work in binary, for example, but may far more often work in Hex! Using Hex, we can group 4 bits together, to create a 'Hex code'. It is a lot easier to remember 4 Hex numbers than 16 bits, for example! To see how this system works, we need to start at the beginning!

Hexadecimal (Hex - base 16)
We have already seen that a digit's worth depends on what position it is in relative to the other digits in the number.

  • Base 10 positions are worth 107, 106, 105, 104, 103, 102, 101, 100
  • Base 2 positions are worth 27, 26, 25, 24 23, 22, 21, 20
  • Base 16 positions are worth 167, 166, 165, 164, 163, 162, 161, 160

How does the hexadecimal system work? The first thing to note is that there are 16 'numbers' in this system: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. It may well seem a little odd using letters to represent numbers: 10=A, 11=B, 12=C, 13=D, 14=E, 15=F. With a little practice, you will see what an excellent system this is.

Just to remind you, to show what system is being used when you write down a number, it is common to use a subscript. So for example: 3410 means (3 x 10) + (4 x 1) whereas 3416 means (3 x 16) + (4 x 1)

As you know, when we write down numbers in our daily life, we omit the subscript because we assume that every one is using base 10. Sometimes, especially in computer circles, it is a dangerous assumption to make! If there is any doubt, then add a subscript! When doing exam questions, always use a subscript, just to show how clever you are!

Let's convert a few more Hex numbers into denary:

  • 3C16 is the same as (3 x 16) + (12 x 1) = 6010
  • 816 is the same as (8 x 1) = 810
  • 3AF16 is the same as (3 x 256) + (10 x 16) + (15 x 1) = 94310

Q6. Convert these numbers into their denary form: 3616 and 316 and FA16 and 2DE16

A better way to convert into and out of Hex
Going from Hex to denary is relatively easy after you've done a few of them. You have to think a little bit harder going the other way, from denary to Hex. But there is a better way! If you remember, we said that Hex and binary were very closely related. As long as we can do binary to denary conversion off the top of our heads, there is a method for converting denary to Hex, and also back again, very quickly. See if you can follow this example. We are going to convert 12510 into a Hex number.

g

h

i

j

You should always check the Hex answer you got. 7D16 = (7 x 16) + (13 x 1) = 12510 so our answer is correct.
(Of course, you could always check your answer using a calculator! In Windows, Go to WINDOWS - ACCESSORIES - CALCULATOR - VIEW - SCIENTIFIC).

k

l

You should always check the Hex answer you got. 4B16 = (4 x 16) + (11x 1) = 7510 so our answer is correct. t may seem a little long-winded, but this method is very mechanical. Once you've done a few, you'll be an expert. Besides, it's good practice for binary conversion!

Q7. Using the above method, showing your working step by step, convert these decimal numbers into Hex:
a) 10310       b) 1410       c) 5810                Don't forget to check your answer.

You can use this method to convert from Hex to decimal, too! Start at Step 5 and work backwards to Step 4, then 3, 2 and 1.

Q8. Using the above method, and showing your working step by step, convert these Hex numbers into decimal:
a) 2916        b) 8516       c) 9916                        Don't forget to check your answer.

Octal (base 8)
This number system is another important numbering system in computing. Octal, or the base 8 system, uses 8 digits: 0, 1, 2, 3, 4, 5, 6 and 7. We have already seen that a digit's worth depends on what position it is in relative to the other digits.

m

n

o

Q9. Using the above method, and showing your working step by step, convert these decimal numbers into Octal:
a) 5010        b) 1410      c) 810     Don't forget to check your answer.

You can use this method to convert from Octal to decimal, too! All you do is start at Step 5 and go backwards to Step 1! After a bit of practice, you can miss out Step 2! It's only there for 'balance' and can be omitted once you know what you are doing.

Q10. Using the above method, and showing your working step by step, convert these Octal numbers into decimal:
a) 2618        b) 208        c) 28        Don't forget to check your answer.

Binary Coded Decimal (BCD)
So far, we have stored numbers as binary, or in a form very close to binary such as Octal and Hex. This is very useful, and allows us to do maths on the codes. In some applications, however, it is more important to maintain a link between the position of a decimal number and the way it is represented in binary. It is useful where you need to store the digits as data type 'character', where you don't do any actual processing on them. An example is a coded sales number.

A mail order company uses codes such as 24361885. This isn't a number! It's a code made up of characters (not 'numbers' in the sense of 'an amount'). The first two characters might be a product code, the third character might be a country code and so on. Now you never 'add' or 'subtract' or do any other maths operations on these codes, but you might need to strip out parts of the code at some point. For example, if you needed to know the country, you would strip out the country character. You could store each character as a byte. If you did this you would need 8 bytes in total (because there are 8 characters). But that is inefficient compared to storing it using BCD. In this system, each character would only need 4 bits, so you would only need a total of 4 bytes to store 8 characters.

Another example of the use of BCD is when you need to store the codes that get displayed on a calculator. Binary Coded Decimal (BCD) is a method for doing just this. You can store each separate digit in a number as a 4 bit code. Each one can then be sent to each part of the display unit that displays just one digit. The BCD can be quickly decoded and turned into instructions that tell the calculator which digit to display. BCD conversion is very straightforward!!

Work through this example

p

It doesn't matter how many denary digits you have - just convert each one into a 4 bit binary code! Going from BCD to denary is equally straightforward. For example, 0111 1001 1000 0000 0100 is the denary number 79804. Isn't conversion really fast? After a few of these, you hardly need to think!

Notice the very close relationship between the position of each denary digit and the position of each 4-bit group.

Q11. Convert these denary numbers into BCD: a) 45       b) 71009       c) 10
Q12. Convert these BCD numbers into binary: a) 1000 0000 0000       b) 0001 1001 (Hint, convert them into denary first.)
Q13. Convert these BCD numbers into Hex: a) 0101 0000       b) 0001 0001 0000 (Hint, convert them into denary first.)
Q14. Convert these BCD numbers into Octal: a) 0001 0000       b) 0011 0000 0000 (Hint, convert them into denary first.)
Q15. Write down the 4 bit combinations that never appear in a BCD number.

 

 

 

 

 

 

 

V7.0 Copyright theteacher.info Ltd 2002 - 2011