Representation Of Data

1,402 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,402
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
53
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Representation Of Data

  1. 1. The Software Developers View of Hardware Representation of Data within a Computer System
  2. 2. Syllabus <ul><li>Representation of data within a computer system: </li></ul><ul><li>Character representation: </li></ul><ul><ul><li>Hexadecimal </li></ul></ul><ul><ul><li>ASCII </li></ul></ul><ul><li>Conversion between binary and decimal. </li></ul>
  3. 3. Why does this mean? <ul><li>Basically, software cannot run without hardware. </li></ul><ul><li>Therefore, this chapter we will concentrate on the following: </li></ul><ul><ul><li>How inputs (data) are represented by the computer? – Binary & ASCII </li></ul></ul><ul><ul><li>How inputs are stored? – Logic Gates </li></ul></ul><ul><ul><li>The processing of data. – Calculations & Understanding Data Streams </li></ul></ul>
  4. 4. How does a computer work? INPUT DECODE PROCESS OUTPUT 001010010100101001101010101010101001010000101010111111100101
  5. 5. Representation of Data <ul><li>Binary is the BASE 2 number system which is represented as electronic voltage (on/off) or importantly as (0 or 1). </li></ul>Decimal Input Binary Control Binary Processing Decimal Output Hexadecimal Storage
  6. 6. Representation of Data <ul><li>The processor of computer system is required to convert between binary and decimal which are inputted and outputted from the system. </li></ul><ul><li>Computers and programs are required to have a comprehensive knowledge regarding these conversions. </li></ul>
  7. 7. Understanding Binary Numbers <ul><li>Imagine you need to illuminate a room with a variable amount of light. You need to be able to set the lighting level from total darkness (0 watts of light) right up to a maximum of 255 watts of light. </li></ul><ul><li>You have 2 options... </li></ul>
  8. 8. One 255 watt bulb and a dimmer <ul><li>With the dimmer set at 0, there is no light, and set at full you would have 255 watts. Varying the position of the dimmer would give varying light output. </li></ul>
  9. 9. But there is a problem... <ul><li>How do you set an EXACT light level? </li></ul><ul><li>The dimmer is difficult to accurately set the light level. </li></ul>
  10. 10. Too much guesswork! <ul><li>So to set the light level at say, 37 watts, you would have to turn the dimmer till it is putting out about 37 watts. </li></ul><ul><li>Trouble is, no matter how accurate you try to be, it will always be an close estimation, not an exact amount! </li></ul>
  11. 11. So what about this? <ul><li>Imagine a set of 8 lightbulbs of varying outputs, from 1 watt right up to 128 watts, with each bulb twice as strong as the one next to it... </li></ul>
  12. 12. So what about this? <ul><li>To set exactly 37 watts of light, you could turn on the 32 watt bulb </li></ul>
  13. 13. So what about this? <ul><li>… then add in the 4 watt bulb… </li></ul><ul><li>(so now you have 36 watts) </li></ul>
  14. 14. So what about this? <ul><li>… and finally the 1 watt bulb. </li></ul><ul><li>You now have EXACTLY 37 watts of light! </li></ul>
  15. 15. So what about this? <ul><li>If you read the bulbs from left to right, they go off, off, on, off, off, on, off, on, or in computer terms... </li></ul>
  16. 16. In other words... 00100101 = 37
  17. 17. Converting Binary To Decimal <ul><li>Binary is referred to as BASE-2 arithmetic. </li></ul><ul><li>This is because it uses two states, on or off (0 and 1). </li></ul><ul><li>The bits 0 and 1 are representative of the on/off circuits within a computer system. </li></ul><ul><li>Computers work in binary, but humans use decimal numbers. </li></ul>
  18. 18. Converting Binary To Decimal <ul><li>To convert the following binary number: </li></ul><ul><li>11010011 2 </li></ul><ul><li>It is best to draw up the following table. </li></ul>1 2 4 8 16 32 64 128
  19. 19. Converting Binary To Decimal <ul><li>To convert the following binary number: </li></ul><ul><li>11010011 2 </li></ul><ul><li>It is best to draw up the following table. </li></ul><ul><li>Then insert the binary number below. </li></ul>1 1 0 0 1 0 1 1 1 2 4 8 16 32 64 128
  20. 20. Converting Binary To Decimal <ul><li>Every time there is a 1 in the column the corresponding number is added to a total. </li></ul><ul><li>128 + 64 + 16 + 2 + 1 </li></ul><ul><li>= 211 10 </li></ul>1 1 0 0 1 0 1 1 1 2 4 8 16 32 64 128
  21. 21. Converting Decimal To Binary <ul><li>To convert the following decimal number: </li></ul><ul><li>110 10 </li></ul><ul><li>It is best to draw up the following table again. </li></ul>1 2 4 8 16 32 64 128
  22. 22. Converting Decimal To Binary <ul><li>But this time find the largest number that will go into 110 10 </li></ul><ul><li>In this case 128 doesn’t go into 110 but 64 does go into 110. </li></ul><ul><li>So we place a 0 under 128 and a 1 under 64. </li></ul>1 2 4 8 16 32 64 128
  23. 23. Converting Decimal To Binary <ul><li>But this time find the largest number that will go into 110 10 </li></ul><ul><li>In this case 128 10 doesn’t go into 110 10 but 64 10 does go into 110 10 . </li></ul><ul><li>So we place a 0 under 128 and a 1 under 64. </li></ul>1 0 1 2 4 8 16 32 64 128
  24. 24. Converting Decimal To Binary <ul><li>The next step is to subtract 64 10 from 110 10 </li></ul><ul><li>110 10 – 64 10 = 46 10 </li></ul><ul><li>Our new number is 46 10 so we must find out what number goes into 46 10 </li></ul>1 0 1 2 4 8 16 32 64 128
  25. 25. Converting Decimal To Binary <ul><li>32 10 goes into 46 10 </li></ul><ul><li>So we place a 1 under the 32 column. </li></ul><ul><li>And 46 10 – 32 10 = 14 10 </li></ul>1 0 1 2 4 8 16 32 64 128
  26. 26. Converting Decimal To Binary <ul><li>32 10 goes into 46 10 </li></ul><ul><li>So we place a 1 under the 32 column. </li></ul><ul><li>And 46 10 – 32 10 = 14 10 </li></ul>1 1 0 1 2 4 8 16 32 64 128
  27. 27. Converting Decimal To Binary <ul><li>The process continues: </li></ul><ul><li>16 10 doesn’t go into 14 10 </li></ul><ul><li>However, 8 10 goes into 14 10 </li></ul><ul><li>14 10 – 8 10 = 6 10 </li></ul>1 1 0 1 2 4 8 16 32 64 128
  28. 28. Converting Decimal To Binary <ul><li>The process continues: </li></ul><ul><li>16 10 doesn’t go into 14 10 </li></ul><ul><li>However, 8 10 goes into 14 10 </li></ul><ul><li>14 10 – 8 10 = 6 10 </li></ul>1 0 1 1 0 1 2 4 8 16 32 64 128
  29. 29. Converting Decimal To Binary <ul><li>4 10 goes into 6 10 </li></ul><ul><li>6 10 – 4 10 = 2 10 </li></ul><ul><li>And 2 10 goes into 2 10 </li></ul><ul><li>Which leaves no remainder. </li></ul>1 0 1 1 0 1 2 4 8 16 32 64 128
  30. 30. Converting Decimal To Binary <ul><li>4 10 goes into 6 10 </li></ul><ul><li>6 10 – 4 10 = 2 10 </li></ul><ul><li>And 2 10 goes into 2 10 </li></ul><ul><li>Which leaves no remainder. </li></ul>0 1 1 1 0 1 1 0 1 2 4 8 16 32 64 128
  31. 31. ACTIVITY 1 <ul><li>Convert the following binary numbers to decimal. (Show working) </li></ul><ul><ul><ul><li>1001 2 </li></ul></ul></ul><ul><ul><ul><li>10110110 2 </li></ul></ul></ul><ul><li>Convert the following decimal numbers to binary. (Show working) </li></ul><ul><ul><ul><li>68 10 </li></ul></ul></ul><ul><ul><ul><li>288 10 </li></ul></ul></ul>
  32. 32. ACTIVITY 2 <ul><li>Identify why hexadecimal is used as a numbering system. </li></ul><ul><li>Convert the following hexadecimal numbers to binary. (Show working) </li></ul><ul><ul><ul><li>A45 16 </li></ul></ul></ul><ul><ul><ul><li>28F 16 </li></ul></ul></ul><ul><ul><ul><li>1001011101 2 </li></ul></ul></ul>
  33. 33. Character Representation <ul><li>It is very important for the development of a key for the translation between the English (Human) and the Binary (Computer) so interaction could be initiated. </li></ul><ul><li>So there were THREE different methods developed with most commonly used being ASCII. </li></ul>
  34. 34. Character Representation <ul><li>1. BCD (Binary Coded Decimal </li></ul><ul><li>Represents decimal values as a 4-bit binary format called nibbles. </li></ul><ul><li>Very good for numbers, but not for other characters. </li></ul><ul><li>i.e. only 16 characters can be represented. </li></ul>
  35. 35. Character Representation <ul><li>2. EBCDIC </li></ul><ul><li>Stands for: Extended Binary Coded Decimal Interchange. </li></ul><ul><li>Represents an 8-bit code which gives 256 possible characters. </li></ul><ul><li>Used primarily for IBM mainframe computers. </li></ul>
  36. 36. Character Representation <ul><li>3. ASCII </li></ul><ul><li>Stands for: American Standard Code for Information Interchange. </li></ul><ul><li>In 1963 it first was used as a 7-bit code that would represent 128 characters. </li></ul><ul><li>However has been changed to an 8-bit system known as Extended ASCII. </li></ul>

×