# Binary

## Recommended Posts

What exactly is binary (I know it's a code that computers use to share and store data), but how does it work, what is it (as in is it electrical signals or something?), and what is the codes, and how does a computer know what 1's and 0's are?

##### Share on other sites

Mathematical: The standard system used is the decimal system which has ten letters {0,1,2,3,4,5,6,7,8,9}. Now, if you start to count you can count to 9. Then you run out of letters. Thus, you write the next integer as 10. Binary system only has two letters {0,1}. In the binary system you then count 0, 1, 10, 11, 100, 101, ... .In both systems the combination of letters is simply a representative of an integer and 6 decimal would equal 110 binary, for example.

Realization for computers: You could think of a lot of other representations than letters. {"Voltage on", "Voltage off"} is used in computers, afaik. So, the decimal 6 from above could be written as OnOnOff.

##### Share on other sites

the far right digit is the number of one's in the number

the second from the right is the number of two's in the digit

third from the right=4's

fifth=8's

and so on in base 2

i also think that there is a value to tell whether it is + or - but i will someone else tell you about that

so binary two is 10 because the "tens" digit represents how many two's there are in the value so...1 value of two + 0 value of ones = 2

and then since there are eight bits to a byte and byte can store a value up to something and the largest number that can be stored in memory is something because of the eight digits in bytes and the number of byte used to store things

that's all i have

##### Share on other sites

to add i think you are right in that the 1's and 0's represent gateways that electrical current can pass through, a certain combination of electrical pathways results in the computer doing what it has been told to do

##### Share on other sites

Or think of it as a on and off switch for your lights. When you place it in the on position, it is 1, when you turn off your lights, it is 0.

##### Share on other sites

>> I also think that there is a value to tell whether it is + or - but i will someone else

I really should have said "natural numbers" instead of "integers" above to avoid that problem. Nevertheless:

Mathematically: What about "+" and "-" ?

Realization on computer: Discussing this in detail imho leads a bit too far for someone who doesn´t even know the binary system. However, for those who know the binary system and are interested in that:

For simplification consider you are limited to three digits ("On"=1, "Off"=0):

In this case the computer would store -1 as OnOnOn,

Adding one then -theoretically- would give OnOffOffOff,

As you only have three digits that´s OffOffOff

So -1 + 1 = 0

The additional On would be stored in the so-called carry-flag in the processor in case it´s needed (may it´s called overflow-flag, haven´t programmed assembler for almost ten years now).

Note that in above case OnOnOn could either be 7 or -1. It´s up to the programmer (or the compiler) to know what´s meant.

##### Share on other sites

Binary conversions:

Dec. Bin.

0 = 0

1 = 1

2 = 10

3 = 11

4 = 100

5 = 101

6 = 110

7 = 111

8 = 1000

9 = 1001

10 = 1010

11 = 1011

12 = 1100

13 = 1101

14 = 1110

##### Share on other sites

Havent noticed *whistling*, been 4 years since college.

##### Share on other sites

What is being discussed so far is numbers in base 2.

However using binary ,i.e., the set {0,1}, a huge variety of codes can be developed. Some of the more popular ones you can find easily are BCD, grey code, XS3 code etc. These are all for encoding numbers.

You then have ASCII codes for characters.

AS situations demand you can come up with a code for practically anything, depending on what code you use, you will build your particular hardware to interpret it.

##### Share on other sites

each column is weighted, just like in Decimal, units, tens, hundreds etc...

in Binary its a little different, its weighted 1,2,4,8,16,32 and so on each weight being exactly 2 times the the number before it.

using only ones and zeros, to represtent a quantity from each weight(1) or Not a quantity (0) any number can be made up

think of the number 27 for example, whats it made up of using 16.8.4.2 or 1

11011

thats one 16 and one 8 and Zero 4s one 2 and one 1. that all adds up to 27

the reason its used in computers is beacause its really easy for a machine to represent, its either On or OFF, like a switch. and transistors make great switches

##### Share on other sites

Just to add, we use binary because we know how to make devices that have two stable states {0,1}. If on the other hand we could get basic components that had 3 stable states, it would at times make more sense to use base three.

##### Share on other sites

there is a type of 3rd state used already, its a Null state (passive) its neither 0 or 1.

its usualy used on shared bus lines. sometimes marked up as OE on a pinout (Output Enable).

##### Share on other sites

now lets move on to hex! : )

##### Share on other sites

Hex is simple 4 bit Binary, exploited as a code in 70s to utilise the 4 bits chips that were 1st produced later. it needn`t have been Hex however, infact for a long time Octal was used

##### Share on other sites

4 bit binary? hex is base 16. might help if i knew exactly what a bit equals i guess : P (isnt a bit just 8 digits or something like that?)

##### Share on other sites

I know the numbers of binary but what about the letters?

(621- 1001101101

A- ???)

##### Share on other sites

Call the "letters" "digits" if that´s more familiar for you. I should indeed have taken the time to look that word up before posting to avoid unnecessary confusion. But in the end the point is just that you have a finite set of symbols (ten for decimal, two for binary) that you name the infinite number of natural numbers with. What does the thing in parentheses mean?

##### Share on other sites

4 bit binary? hex is base 16. might help if i knew exactly what a bit equals i guess : P (isnt a bit just 8 digits or something like that?)

a "bit" is a single number, a 1 or a 0

a "Nibble" is 4 bits and used to represent a single Hex number

a "Byte" is 8 bits or 2 nibbles

then we move onto "Words" and "Long words" usualy 16 bits and 32 bits respectively.

##### Share on other sites

yeah, a bit = 1 or 0

no one uses nibbles anymore!

byte = 8 bits

kilobyte = thousand bytes

megabyte = million bytes

gigabyte = 1000 megabytes (you do the maths for bytes!)

terrabytes = 1000 gigabytes.

however, those are not precise values, they are standardised figures, for instances kilobyte is actuallly 1024 bytes and megabyte is 1,000,024 bytes (etc) - but the first lot is accepted by everyone - though if i hadnt have said this paragraph someone would have said that i was wrong!!!

##### Share on other sites

mB is 1,000,024?

i know about a kB being 1024, but i would have expected mB to be either 1,024,000 or 1,024^2.

##### Share on other sites

just hit the 2x2 constant on a calculator and keep pressing enter, that take you up to a fair old number all in Binary weighting

##### Share on other sites

Its 2^10 thats why 1024 is popular.

Its an awesome number as it a perfect power of 2 and nearly perfect power of 10. So its easy to work with it.

##### Share on other sites

no one uses nibbles anymore!

oh is that so?

then a Burst nibbler or 7 segment LED/LCD displays no longer exist either?

## Create an account

Register a new account