Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Hardware/Software.
Acmlm's Board - I2 Archive - Hardware/Software - Question about Binary code.
  
User name:
Password:
Reply:
 

UserPost
||bass
Posts: 210/817
When you ask how does the computer know what the binary code means, I assume you are asking about how machine code works.

Let's use a simple example.

The chip we will use for this example is the BIC9000 or Bass' Imaginary Chip 9000.

The BIC9000 has a single 8 bit register.
It has 4 instructions and can address 16 bytes of memory.

Our 4 instructions are as follows:
GET - Get's a value from memory and puts it into the register.
ADD - Adds the value in the register to a specified address in memory.
STO - Takes value from the register and stores it into a specified memory address.
HLT - Halts processing.

The binary values of the instructions are as follows.
GET = 00000001
ADD = 00000010
STO = 00000011
HLT = 00000100

Now lets say that we want to make a simple program to add two integers togather.

Now, we have 16 bytes of memory to work with, each byte can store either an instruction or a data value.

Our program will look like this

GET 9 - Gets the value from address 9 and stores it in a register.
ADD 10 - Adds the value from address 10 and adds it to the value in the register.
STO 11 - Stores the new value from the register into address 11.
HLT - Ends the program.

Byte by byte the program will have the following data.

Byte 1: 00000001 (The value of the GET instruction)
Byte 2: 00001001 (The value 9)
Byte 3: 00000010 (The value of the ADD instruction)
Byte 4: 00001010 (The value 10)
Byte 5: 00000011 (The value of the STO instruction)
Byte 6: 00001011 (The value 11)
Byte 7: 00000100 (The value of the HLT instruction)

So if our byte 9 and 10 look as follows:
Byte 9: 01000000 (The number 64)
Byte 10: 10000000 (The number 128)

Then byte 11 will be as follows once the program has run:
Byte 11: 11000000 (The number 192)

Bytes 8, 12, 13, 14, 15, and 16 will contain the value 0. (They dont matter)

Our total program will look as follows before the program runs.
000000010000100100000010000010100000001100001011000001000000000001000000
10000000000000000000000000000000000000000000000000000000

Our total program will look as follows after the program runs.
000000010000100100000010000010100000001100001011000001000000000001000000
10000000110000000000000000000000000000000000000000000000

Hope this helps...

[HH: But let's not stretch the page. Closing colour tags might be good too.]
Cornellius
Posts: 167/460
Take the chip 7404 for example. His job is to invert. He's called an INVERTER

http://www.datasheetarchive.com/index.html

Look for the DM7404

There are pins for the Vcc (Voltage alimentation), the GND (The ground) and the pins with the inverters. There is 6 main logic gates, as I mentionned earlier. As you can see, they all have different combination of ZEROs and ONEs at the output.

The pin 14 is for the VCC
The pin 7 is for the GND

The others are the inverters. You see, if I put a ZERO at pin 1, a ONE will result at pin 2. If I put a ONE at pin 1, a ZERO will result at pin 2. This is only for the inverter. There are a damn lot of chips availaible including one of the six main gates, or a combination of two or more. The chip is carefully choosen depending on what we want to do.

Other chips examples :

7408 - is an AND chip. The symbol you see on the datasheet is the AND symbol.
7432 - is an OR chip. The symbol you see on the datasheet is the OR symbol.

Hope it helped. Feel free to ask if you have questions !
neotransotaku
Posts: 2538/4016
yeah...depending on what voltages those doors (or gates as I call them) have been applied, different parts of an electronic chip will do different things. however, when gates are strung together, that is when work is done. Other types of electronic components do different things as gates aren't the only things operating.
Cornellius
Posts: 163/460
Inside the chips, there is what we call ''Logic Doors''.

AND
OR
NOT
XOR
XAND
NAND

------
AND
------

1*1=1
0*1=0
1*0=0
0*0=0

--------
NOT
-------

1=0
0=1

This is simply an inverter.

------
OR
-----

0+1=1
1+1=1
1+0=1
0+0=0

--------
XOR
-------

1+0=1
0+1=1
1+1=0
0+0=0

---------
XAND
--------

1*1=1
0*0=1
1*0=0
0*1=0

---------
NAND
---------

1*1=0
0*1=1
1*0=1
0*0=1

The multiplication symbol ''*'' means an AND and the plus symbol ''+'' means an OR.
FreeDOS
Posts: 1201/1657
That's the biggest problem with AI: Is It really intelligent?
But then, you'd have to define what AI is, and that's changed many times over the decades.

Someone carefully constructed the chips to act a certain way with certain bits. Like HH said, mind-blowing.

edit: so is the telephone
HyperLamer
Posts: 3540/8210
Editing does that to some sigs, apparently. Anyway, the switches don't really 'mean' anything, they're just ordinary electronic switches. Same idea as a light switch only several billion times smaller (and controlled by electricity; no moving parts). Different combinations route electricity different ways, which makes the computer do different things. It really is mind-blowing to think that all the video games you play, web sites you see, programs you run, and even the most intelligent of AI is nothing more than electricity running through gazillions of switches...
Ten
Posts: 83/198
Well that answer is the straitest I've gotten so far but it's a bit too simple.

By the way, My sig shouldn't be double spaced like that, I think edit mode must of done that.
Cornellius
Posts: 160/460
1 = High Level = ALMOST 5 Volts
0 = Low Level = ALMOST 0 Volts

It's all in the chips hands. If the chip receive a High Level, it will react by doing something and if it receive a Low Level, it will have another reaction and will do something else.

I don't want to flame but, is you sig, well, a liitle too long ?
Ten
Posts: 82/198
We all know that computer data is a bunch of on ond off switches represented by ones and zeroes. But one thing I've always wondered is how the computer is suppose to know what all these switchs are supposed to mean in the first place. But every time I ask this no one gives me a actual answer to it. Does anyone know the answer to this?

And yes, I already know that ones and zeroes are the same as the north and south points of a magnet, that doesn't answer my question though.
Acmlm's Board - I2 Archive - Hardware/Software - Question about Binary code.


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.009 seconds.