View Full Version : exam tomorrow!!!!!!!
wb
26th October 2005, 21:00
Exam tomorrow :yikes: On top of most of it EXCEPT I cant get my head around how ASCII codes work, and how to to convert Binary Numbers to Decimal.
here are 2 examples:
Convert the following binary number to decimal: 1000 1001
Convert the following decimal number to binary: 65
I tried to google it, but still could not work it out. Is there a simple way of doing this, or should I cut my losses and swot up on the other stuff instead :yikes:
MarcusMel
26th October 2005, 21:16
1000 1001 = 89Hexadecimal = 8*16 to power1 +9*16 to power 0. Any positive number to the power zero = 1 and 8*16 = 128 therefore 89Hexadecimal = 128+9=137decimal
in decimal units are 1 to 9 times 10 to the power zero then the next colum is digit times 10 to the power 1 and then the next column is 10 to the power 2 or the hundreds column. The same thinking then applies to whatever base you use. Say you decide to work in base 6. That is pretend you only know of 5 ways of writing down a number. So when you come to write 6 down you have run out of symbols to use so you write in your whole 6's column 1 and in your units column 0 or simply put 10!
In other words in base 6 you count 1,2,3,4,5,10,11,12,13,14,15,20,21,22,23,24,25,30....
Now you reduce the number of symbols you have to represent numbers down to 0 and 1 and you have binary. :doh
Fadetoblack
26th October 2005, 21:18
I got dizzy reading that.
John
26th October 2005, 21:28
Hi Wayne,
1000 1001:
The way I would do this (although I don't know if it's correct) is starting from the right hand number, or column, for want of a better word.
Starting from the right going leftwards, each column has its own value, which doubles every time you move up one column further to the left. So we begin at 1, and have 8 columns in total, which are therefore labelled 1, 2, 4, 8, 16, 32, 64, 128.
Any column that has a zero in it doesn't get added mathematically. So we can pretty much ignore it from the equation.So starting rightmost: 1001 0001, where values of 1 lie in the first, fifth, and eighth column.
Therefore 1 (first column) + 16 (fifth column) + 128 (eighth column) = 137.
--------------------------------------------
Converting the number 65 to binary is also pretty simple:
Again imagine you have 8 columns as before, starting at 1 on the far right moving left, and doubling every time you move a column left.
So, we have to make the number 65 from 8 columns...
0100 0001 would be the best possible option, as it uses the fewest 1 values and adds up to 65 through our assigned column values.
--------------------------------------------
I know I haven't explained this particularly well, and it's in a few bits and pieces, but I hope you get the general jist.
Good luck with your exam. :)
MarcusMel
26th October 2005, 21:32
65 divided by 2 = 32 remainder 1
32 divided by 2 =16 remainder 0
16 divided by 2=8 remainder 0
8 divided by 2= 4 remainder 0
4 divided by 2= 2 remainder 0
2 divided by 2 =1 remainer 0
1 divided by 2=0 remainder 1
Now write the result going left to write from the last remainder result to the first
1000001 or 1*2^7 + 0*2^6 + 0*2^5 + 0*2^4 + 0*2^3 + 0*2^2 + 0*2^1 + 1*2^0
Where ^ means to the power
2*2=2^2
2*2*2=2^3
2*2*2*2=2^4
mathare
26th October 2005, 21:37
1000001 or 1*2^64 + 0*2^32 + 0*2^16 + 0*2^8 + 0*2^4 + 0*2^2 + 0*2^1 + 1*2^0
Where ^ means to the power
2*2=2^2
2*2*2=2^3
2*2*2*2=2^4Not quite MM.
I believe the powers should be 0, 1, 2, 3, 4, etc not 0, 1, 2, 4, 8, etc.
wb
26th October 2005, 21:41
cheers lads, think im getting the hang of it!
can someone see if this example is correct:
convert 1000 0111
128 (1) 64 (0) 32 (0) 16 (0) 8 (0) 4 (1) 2 (1) 1 (1)
again, ignoring all the zeros, you get 1 + 2 + 4 + 128 = 135
Answer 135 ????
mathare
26th October 2005, 21:46
Looks good to me Wayne, aye
MarcusMel
26th October 2005, 21:52
Whats to know about ASCII?
The first 32 numbers are reserved as control characters 0 nul to 31. If you press the control key on the keyboard you are asking for ASCII number with the numerical equivilent of the letter you press. e.g control M is the carrage return key or is exactly the same as pressing the enter or return key on your keyboard.
So the ASCII code is a way of assigning symbolic meaning to a binary number.
Capital letter A=65 ASCII - So you hit the A key on your computer and in the memory of the computer 65 in binary is stored but only because of the programs that have been written does the computer 'know' to assign the meaning of uppercase A to that value. 65 can just as easily mean 'do nothing' if that is the way its meaning has been programed.
GlosRFC
26th October 2005, 21:57
ASCII (American Standard Codes for Information Interchange) codes are simple....they're just substitution codes in the same way as you can reverse the alphabet so that A=Z, B=Y, C=X and so on. Another ASCII type code is where you shift the characters along the alphabet so that A=C, B=E, C=D, and so on.
You have to remember that the original ASCII codes were designed for teletype printers so the first 32 characters were reserved for non-printable characters like backspace (ASC8) and line feed (ASC10). There was even an ASCII code to make the teletype bell ring (ASC7) but I don't think many printers do that nowadays! In the original ASCII table, ASC(32) was a carriage return and then the first proper character was ASC(33) or a space. Alpha characters started at ASC(65) for capitals (A) through to ASC(122) or z.
They only allowed 127 combinations due to the 7-bit processing that was common at the time. Put simply, each bit was a binary number, e.g. 1 or 0 and you could have a total of 7. So the biggest possible number was 1111111. As each number represented a power of 2, that is the same as saying 64+32+16+8+4+2+1 = 127. So every 7-bits could represent any one of 127 different characters.
As time went on, 8-bit processing become the norm and so extended ASCII was developed. This kept the same 127 characters as the previous ASCII table but, because you had an 8th bit (or 128 in binary notation), you could convert 255 characters. This meant that foreigners, e.g. non-US based computer users, could include special characters like £ or Ñ or ¼ or ©. You can create your own ASCII table by holding down the ALT key and typing each of the 255 combinations on your keypad. ALT + 184 will give you the © symbol.
Unfortunately, 255 characters wasn't enough to cover all of the world's alphabets and so ASCII become redundant and was replaced with codepages. Each language required its own codepage and, without going into too much detail, it was a real bind to use. So that didn't last long.
Nowadays, computers use a system called Unicode whereby every single character is given a number and allocated a space within the Unicode table. Unicode can also be combined so that you can produce all those weird French letters that have accents and graves. To make things simple for us anglo-saxons, the standard Western alphabet was designated the same Unicode numbers that they were given under the old ANSII system, except that Unicodes are expressed in Hexadecimal. So U+41 and ASC(65) wil both give you an "A".
wb
26th October 2005, 21:58
and just to be sure,
the opposite conversion:
Convert 135
135/2 = 67 with 1 remainder (1)
67/2 = 33 with 1 remainder (1)
33/2 = 16 with 1 remainder (1)
16/2 = 8 with no remainder (0)
8/2 = 4 with no remainder (0)
4/2 = 2 with no remainder (0)
2/2 = 1 with no remainder (0)
1/2 does not go, so 1 remainder (1)
Read from bottom to top: 1000 0111
GlosRFC
26th October 2005, 22:02
One of the cheapest ways to do number base conversions is:
Open Calculator. (Start, Programs, Accessories, Calculator)
Click on View, Scientific.
Make sure the Decimal (Dec) button is pressed and enter your decimal number.
Now click the Binary (Bin) button and check if the answer is the same as yours.
You can also convert Hexadecimal and Octal numbers the same way. With a bit of practice you'll soon get the hang of it.
MarcusMel
26th October 2005, 22:02
128 +7 = 135 = Yep thats correct :D
MarcusMel
26th October 2005, 22:05
Not quite MM.
I believe the powers should be 0, 1, 2, 3, 4, etc not 0, 1, 2, 4, 8, etc.
Yeah thats right - mind gets overloaded with info at times. Ooo
wb
26th October 2005, 22:06
Jaysus!!!
is there anything you cant do on this forum.???
thanks a million, really appreciate it.
Good Rep all round.
Cheers,
Wayne
wb
26th October 2005, 22:07
Time for a beer after all that! :hic
GlosRFC
26th October 2005, 22:11
10000111 is correct. Now do the following:
H15B + B10011 * O45 / 8
347 + 19 * 37 / 8 = 1692.75
:D
MarcusMel
26th October 2005, 22:25
10000111 is correct. Now do the following:
H15B + B10011 * O45 / 8
347 + 19 * 37 / 8 = 1692.75
:D
Yuk!
347+19*37/8
is not a pretty answer :(
Powered by vBulletin™ Version 4.0.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.