300 likes | 796 Views
Coding System . Text Representation ASCII Collating Sequence. What is a BIT. As w know a bit is the smallest unit in a computer system A bit can either be a 1 2 or a 0 2 This means that with one single bit we can only represent only 2 different values 1 2 = 1 10 and 0 2 = 0 10.
E N D
Coding System Text Representation ASCII Collating Sequence
What is a BIT • As w know a bit is the smallest unit in a computer system • A bit can either be a 12 or a 02 • This means that with one single bit we can only represent only 2 different values • 12 = 110 and 02 = 010
Representing Text, Pictures ect … • Text, pictures and videos are also stored in a computer system using a sequence of binary digits • Using one single bit is not enough due to its small size • If we want to store a large quantity of data many more bits are required.
Combining a number of Bits • Each time a bit is combined with another bit, more different combinations can be stored. • If we will be using two bits to store data, there are a total of 22= 4 different combinations • Hence if we have 4 bits we would have 24= 16 different combinations
Working • With the following number of bits how many combinations could be created? • 5 bits • 3 bits • 6 bits • 8 bits
Answers • 5 bits = 25 32 combinations • 3 bits = 23 8combinations • 6 bits = 26 64combinations • 8 bits = 28 256combinations
In the Early Days • When computers were first introduced they were simply used for performing calculations • After a while scientists realized that computers can also be used to store and edit text in different ways • The problem was that a computer could only understand binary (1s & 0s)
ASCII Coding System • The scientists had to come up with a way for binary to be able to represent characters • ASCII (American Standard Code for Information Interchange) was developed • With ASCII every single character is assigned a binary code • ASCII also allows computers to communicate with each other(files containing text can be copied from one computer to another)
How ASCII Coding Works • The first ASCII system used a series of 7 Bits • This meant that 27=128 different characters could be used • These 128 characters are represented in the following table
Now a Day’s • The first 32 characters were used for transmission purposes, they are no longer needed • After some time it was noted that ASCII consisted only of the English alphabet, so an extra bit was added to accommodate more languages, graphics and mathematical symbols • By adding an extra bit 128 more characters can be stored since 28=256.
Try it! • You can check the symbols on your computer by typing in its decimal code • Open Notepad (Start > Programs > Accessories > Notepad) • Make sure that NUM LOCK is switched on • Press and hold ALT • From the Numpad enter the 3 digits that you want (example 234 for Ω) • Release the ALT, and the symbol should appear.
Important Note • It is important that all computers use ASCII as otherwise different codes would represent different values • Example if a computer used the XYZ system (fictitious) and another uses ASCII the work HELLO would be represented differently on the two machines
Coding in ASCII • We must use the ASCII table to be able to code the following;
Example of XYZ system • Remember this is fictitious
When the computer with the XYZ representation system receives the text file from the computer with the ASCII representation system instead of HELLO, one will see $!**-, which is completely wrong! • Since nowadays computers are used across the world a new system is being used which is UNICODE • UNICODE is compatible with ASCII but then it uses a different system. A list of UNICODE characters can be accessed on http://en.wikipedia.org/wiki/List_of_Unicode_characters.
Work • Code the following word using ASCII;
Collating Sequence • The character codes assigned to the characters in ASCII are very important since they can be used to sort letters and distinguishing from upper to lower case letters • For instance if the letters C, V and B have to be sorted, they can be easily sorted by looking at their ASCII code and use it to sort text in ascending (AZ) or descending order (ZA).
Example • Using the ASCII codes the computer could sort the letters in ascending or descending order by sorting the ASCII code (numbers)