# Lesson video

In progress...

Hi, I'm Rebecca your Computing Teacher for the Data representations unit.

For this lesson you're going to need a pen and paper to make any notes and do any calculations.

You're also going to need to make sure that you remove as many distractions as you possibly can out of the way, so that you can really focus this lesson.

Once you've got out ready, we can begin.

In this lesson, you will explain how ASCII is used to represent characters and its limitations.

You're to explain what a character set is.

You'll explain the need for Unicode.

And you'll be able to calculate the number of bits needed to store a piece of text.

What I'd like you to do is work out how many combinations of ones and zeros can be made with just four bits.

So I've made a start for you there.

I've done the first two and you need to try and work out how many other combinations there might be.

So pause the video while you do that.

Awesome.

It was 16 combinations.

If you take a look, I've drawn them all out there for you.

You've probably done that as well on your piece of paper to work out.

But actually, if you take a look, now four bits, the highest value that you can make with four bits is 15.

If you go one higher, you go to the next column.

And that will be 16.

And actually, if you've got 15 is your maximum.

So 1111 15 is the highest number, but also if you count zero with that you've got 16 combinations.

So what you do, the trick is, is if you've got.

If you're given a question like this.

So four bits, how many combinations? You think, well, what's the highest number I can make with four bits? So 1111.

And what's that in decimal? 1111 is 15.

And then you just add one more number to it, which would be 16.

And that's how many combinations you'll get.

So if you get another the question like that later on, then maybe you'll be able to remember this little trick and it will help you out next time.

So, how many bits do you think you could, you would need to represent all 26 letters? So this is a little bit trickier, but maybe not.

May be you could work away my little cheat backwards and see if that will help you work out the answer.

So pause the video while you have a think.

So the answer is you would need five bits.

Five bits would give you 32 combinations of ones and zeros.

So you would need to do 32 because if you were doing four bits, you'd only get 16 combinations.

So you're definitely going to need five bits for just those letters of the alphabet.

But what about these? If you were trying to represent text, you couldn't just have A to Z in capital letters.

You've got capital letters, you've got lower case, you've got digits.

So all there's numbers as well.

You've got punctuation and then you've got other languages to consider as well.

So we'll think more about this later on in the lesson about how many bits might be required and how you might represent them.

Computers use binary numbers to represent everything.

So how does a series of ones and zeros represent text? How were messages sent before we had computers? Well, there were smoke signals, carrier pigeons, messengers, post, and a Telegraph.

That's a picture of a Telegraph they're on your screens now.

And messages were often coded using systems like Semaphore and Morse code.

And you can see those two there.

So Semaphore was flagged positions to represent letters.

And Morse code were dots and dashes to represent letters.

The same principles were applied to computers.

A coding system was created where a combination of ones and zeroes could represent a character.

And we call this a character set.

So ASCII was one of the first character sets that was used in modern computing.

It was originally created in the 1960s to standardise the coding systems used in teleprinters.

And that's a picture of a teleprinter there on your screens.

So ASCII is a seven-bit coding system.

How many characters could be represented with a seven-bit coding system? Can you use my little trick to help you work that one out? Pause the video while you think about it.

You just add one and you get 128.

You might have also noticed that actually the next column along is also 128.

So you could look at it that way as well if you wanted to.

Each character has its own unique binary code that is represented by seven bits.

So you can see there we've got A as 100001, and so on.

Now, eight bits are now used to store each character in the ASCII character set.

The original coding system remains, but with each code having a proceedings zero bit.

So, when you look around and you might see these texts to binary conversions, you'll see that there's always that extra zero digit in front of it.

But it's still the same combinations of ones and zeros.

It's just got a proceedings zero as well.

Take a look at the bit pattern for the letter C.

Can you predict what it might be for the letter D? And the tip is try and spot the pattern.

There is a pattern there and a note if you don't.

if you're not sure what a bit pattern is, a bit pattern is a term used to describe a combination of ones and zeroes.

So see if you can pause the video, and make a prediction about what the binary, the bit pattern might be for the letter D.

Pause the video.

Let's take a look then.

So it was actually 01000100.

So the code for each character increases by one each time.

If you take a look at those, just those characters on the right hand side, you've got zero one, which is one.

one zero, which is two.

one, one, which is three.

And then the next one along one, zero, zero is four.

So it's just increasing by one each time.

Now this is a portion of the ASCII table.

The ASCII table, we've already established has how many characters? It has 128 characters.

So obviously there aren't 128 characters on your screen.

There are just the 26 letters of the alphabet and the space as well 'cause you're going to need that one too.

What you're going to do is your going to carry out some ASCII conversions using your worksheet.

So use the ASCII conversions worksheet to complete some tasks where you will write in binary and decode a message.

Pause the video while you do that.

Fantastic.

So this was the solution to task two.

There's no point in putting the task one solution, 'cause that was to write your name, wasn't it? So I called possibly put the answers for everybody's name there.

So this, "Use your abbreviated ASCII table to decode this message" was the question.

And the solution was, "I LOVE COMPUTING" Hopefully, you got to, maybe the third letter of computing and you realise that would be what it was.

But you might've gone all the way through too.

So, what is it missing? The ASCII character set can hold a maximum of 128 characters.

It includes so non-printing characters, lowercase and uppercase letters.

Digits, so there's numbers.

punctuation, punctuation symbols, and mathematical operators like plus, divide, minus and multiply.

But what is missing from those? Other languages, for example, Chinese characters aren't on there.

Emojis too aren't represented in those 128 characters and also special characters like half and things like that.

They're not represented either.

And this is where Unicode comes into play.

So Unicode was created as an extension of ASCII.

Unicode uses up to four bytes, that's 32 bits per character.

How many combinations is that? Can you figure that one? That's a big one that is.

Don't worry if you can't make that one out.

Let's have a look.

It's actually a lot, it's around 138,000 characters or combinations of those zeros and ones.

That is an awful lot, isn't it? The first characters listed in the Unicode character set are exactly the same as ASCII.

This has to do ensure that the Unicode character set is backwards with compatible with ASCII.

And hopefully most of the systems out there always have that approach.

There's some that don't, but that is the standard.

The introduction of Unicode meant that more characters could be used.

And this was particularly useful for using the internet as a global communication tool.

So calculating text file sizes then.

Let's have a look at what we do in order to calculate those texts file sizes.

So one character is going to be one byte.

So if you remember, we have those initial seven bits, but actually, nowadays ASCII stored in one byte.

So eight bits.

So A is one byte.

So each character that uses the ASCII character set, uses one byte of storage.

How many bits are there? There are eight bits in a byte.

How many nibbles or in a byte? Can you remember that one? There's two nibbles in a byte.

And how many hex values are used to make, for a byte? Yeah, you can have two hex values.

So a text file is created that contains all of the letters in the alphabet.

So all 26 letters.

What would the file size of that text file be? How many bites is that going to take up? It's going to be number of characters, times one byte.

So it's going to be 26 bytes.

What is 26 bytes in bits though? What kind of calculation will we have to do for that? So it's going to be 26 times 8 because there's eight bits in a byte.

So if we did 26 times 8, then we're going to be able to work out the bits.

Can you do that? So if you wanted to do this in your exam.

And you wanted to make sure that you got it right, a good way to do it is do the 20 times 8 first.

'Cause then that's essentially just two times eight, and then you put a zero on the end.

And then you do the six times eight, which would be 48.

So if you wanted to.

If you weren't sure how to do 26 times 8 in your head, then you do the 20 times eight.

Then you do the six times eight, and then you do those two numbers added together at the end to get your answer.

So there are 208 bits in 26 bytes.

You're going to have a go yourself now.

Then calculate the file size in bytes of this text.

And it says don't forget the spaces.

So take a good look at that text.

See if you can figure out how many bytes it's going to take up in that file size.

Pause the video while you do that.

So the answer was 43 bytes.

Now, I bet there's a few of you that might have got this wrong.

And I promise you I got this wrong as well.

And that is because I missed out last space there, when I was doing my calculations.

I double checked it in a word package to see how characters so far? And it came up 43 and I was like, I had 42.

Why is it 43? And it took me ages and ages to figure out.

It was because of that space there.

So don't be fooled.

Learn from my mistakes.

Make sure that you count it.

If it goes over two lines, make sure you count that space as well.

So, that was a whistle-stop tour into how we represent characters and text using those binary ones and zeros.

And how we calculate the file size.

Hopefully, you've gained a little bit more from that lesson and you've had a little practise as well with your conversions.

And thinking about bits and bytes as well.

And how to go from bits to bytes and do those calculations too.