Octal - 3056 Hexadecimal 37AD Decimal - 32767 Binary ... 13 HNC Unit 22 LO2_3 PLC Number...

Post on 21-Aug-2020

11 views 0 download

Transcript of Octal - 3056 Hexadecimal 37AD Decimal - 32767 Binary ... 13 HNC Unit 22 LO2_3 PLC Number...

LO2.3 Number systems used by PLCs

Binary - 1010100011

Hexadecimal – 37AD

Decimal - 32767

Octal - 3056

LO2.3 Number systems used by PLCs - Assignment

Take the following 16 bit binary number 1100100011000011 and show how you would convert it to Decimal, Octal and Hex. LO2.3

We can base our number systems on any number. For example we base our monetary system on 10. Decimal, Binary, Octal and Hex are used by computer people and in the PLC world, so that’s three we need to learn about. So how do Number Bases work?

LO2.3 Number systems used by PLCs

The column heading for Decimal (base 10) numbers are: 10000 1000 100 10 1 These are from: 104 103 102 101 100 So 3456 is 104 103 102 101 100 0 3 4 5 6

LO2.3 Number systems used by PLCs

So 3456 is 104 103 102 101 100 0 3 4 5 6 This means: 3* 103 = 3*1000 = 3000 4* 102 = 4* 100 = 400 5* 101 = 5* 10 = 50 6* 100 = 6 * 1 = 6

LO2.3 Number systems used by PLCs

Now humans can handle base ten. But computers can only deal with things being on or off. So we want some way of representing a number bigger than one, as a series of 1’s and 0’s. How many different states can a decimal digit have?

LO2.3 Number systems used by PLCs

Now humans can handle base ten. But computers can only deal with things being on or off So we want some way of representing a number bigger than one as a series of 1’s and 0’s. How many different states can a decimal digit have? 10 (that is 0 to 9) How many different states can a binary bit have?

LO2.3 Number systems used by PLCs

Now humans can handle base ten. But computers can only deal with things being on or off So we want some way of representing a number bigger than one as a series of 1’s and 0’s. How many different states can a decimal digit have? 10 (that is 0 to 9) How many different states can a binary bit have? 2 (that is 0 or 1)

LO2.3 Number systems used by PLCs

The column headings for decimal are, as we said: How many different states can a binary bit have? 2 (that is 0 or 1) So what are the column headings for binary?

LO2.3 Number systems used by PLCs

104 103 102 101 100

10000 1000 100 10 1

Binary column headings are

LO2.3 Number systems used by PLCs

24 23 22 21 20

16 8 4 2 1

So if for a Binary number we have:

24 23 22 21 20

1 0 0 1 1

What number is this? Well it’s 100112

But how do we convert that to decimal?

LO2.3 Number systems used by PLCs

24 23 22 21 20

1 0 0 1 1

24 = 2*2*2*2 = 16 21 = 2 20 = 1 100112 = 1910

LO2.3 Number systems used by PLCs

Exercise 2 Create the column headings for numbers at base 16 If I have the number 175 how does that convert to Hex? What problem do you have? Can you think of a solution?

LO2.3 Number systems used by PLCs

LO2.3 Number systems used by PLCs

Problem – With base 16 how can we represent the numbers 10 to 15 with one digit each?

Solution – We use letters for 10, 11, 12, 13, 14 and 15

So the numbers go 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F So 175 decimal is AF in hex i.e. (10*16) +15

Conversion of Binary to Hex – We could convert to decimal and then to Hex ..... Exercise 4

LO2.3 Number systems used by PLCs

Break the number into fours from the right. 1101 0110 0001 1011 And make a Hex digit from each group of four “four bit” binary groups. 8 4 2 1 1 1 0 1 so this is worth? 13 and in Hex that is D Exercise 4: Convert it and see what you get as an answer

LO2.3 Number systems used by PLCs

Let’s convert the number below to Octal (base 8). 1101011000011011

LO2.3 Number systems used by PLCs

Let’s convert the number below to Octal (base 8). 1101011000011011 In base 8 what is the biggest value digit you can have? ........... And how many binary bits do you need to represent it? ........... So we can split the big binary number into blocks of .......... each of which represents an octal digit.

LO2.3 Number systems used by PLCs

Let’s convert the number below to Octal (base 8). 1101011000011011 Make an Octal digit from each group of 6 “three bit” binary groups starting on the right. 4 2 1 1 0 1 so this is worth? 5 Exercise 4: Convert the binary number above to octal

LO2.3 Number systems used by PLCs

Let’s convert the number below to Octal (base 8)

LO2.3 Number systems used by PLCs

1 5 3 0 3 3

85 84 83 82 81 80

1 101 011 000 011 011

32767 4096 512 64 8 1

= 1530338