Question:
How does binary code work...?
Ben
2010-08-17 21:00:43 UTC
How does binary code for computers work?
How can simple zeros and ones tell a computer what to do?
Do any programmers learn binary, or is something like C++ perfectly capable of allowing for lots of programming opportunities without going any lower level.

Thank you,

-Benjamin, (Starting to learn c++)
Nine answers:
oops
2010-08-17 21:24:52 UTC
How can simple zeros and ones tell a computer what to do? To answer that, you need a basic understanding of digital electronics.

http://en.wikipedia.org/wiki/Digital_electronics



To "learn binary" is sort of a meaningless statement. Do most programmers understand the concept of how computer data is stored? I think so. It's not completely necessary, but it is useful when trying to understand certain data structures and algorithms.



If you're asking "Do programmers learn machine code?". No. Unless you are creating a compiler or assembler, in which case you have to output the machine code to an executable file. And even then, you don't take time to memorize it, you just create a set of aliases (defines) for each code and use those.
2016-12-25 02:55:24 UTC
1
Virux
2010-08-17 21:29:59 UTC
I think I've developed the perfect explanation for this last night, actually.



Alright, on the basic of basic levels, a computers communication is based on oscillation of electrical signals. Each signal sent, has a bit-time. On a basic level, bit-times are composed of two parts. Bit-Time 1st half, and the Bit-Time 2nd half. Like this: [___|___]

Now, by using very accurate timers, we're able to send an electrical pulse in one of these Bit-Time half's. Binary is made up of 1's and 0's.. which means:

_____v Electrical Pulse

[___|_#_] = 1



__v Electrical Pulse

[_#_|___] = 0



So, for example, if each Bit-Time( [___|___] ) was exactly 1 second long, that means each half would be 500 milliseconds. By sending a pulse in the first 500ms, that equals a 0. By sending a pulse in the 500-1000ms range, would equal a 1.



A byte, would be sent with 8 bits(Bit-Times) in this example, each byte proceeds with a bit-time that has both electrical pulses, and also ends with a bit-time with both electrical pulses. So each byte is actually equal to 10 bits, even though only 8 of them are significant to the value.



From here, it's pretty simple. It's basically 8-bit Binary. 8 bits to a byte.

A capitol letter "A" is: 01000001

Which means, the oscillation for "A" would be:

_X___1____2___3___4___5___6___7___8___X

[#|#] [#|_] [_|#] [#|_] [#|_] [#|_] [#|_] [#|_] [_|#] [#|#]

_____0___1____0___0___0___0___0___1



And then you've got the letter "A" in this very basic example.

Simply by sending more bytes, you get more data.

Pretty overwhelming when you think about how fast bytes are actually sent and received, even in just the average internet speed, 7mb/s, your getting(at max) 58, 720, 256 bits per second. It almost seems like alien technology.



However, the actual binary programming language is quite different: and extremely hard. There are very few people in the world that code in binary.

But, all programming languages end up as binary eventually. When you compile your code, your compiling it into machine code, which is not far from binary signals.

Unless if you're coding something like Java, where you compile your code into an archive, and then the archive gets compiled into machine code when run-- this is called interpretation, or, "interpreter languages"



C++ is all you will ever need. Most people only go to a lower level when they are writing firmware, or if they want to further enhance performance. C++ has the capability to do anything you need as far as applications go. C++ can also create drivers or anything else you would need.
green meklar
2010-08-17 21:42:35 UTC
>How does binary code work...?



Binary is really just an alternative represention for numbers. Normally we use base ten to represent numbers, where the ten digits are:

0123456789

In binary (also known as base two), there are only two digits:

01

This makes things somewhat easier, since you don't have to worry about multiple positive values, you just have 1 and 0 for every digit.



For instance, let's say you wanted to represent the number 14 in binary. You would do it as follows:

- 14 is less than 16 and greater than 8, so we start at digit 4.

- 14 contains 8, throw away 8 to get 6 and put a 1 at place 4 for 1000.

- 6 contains 4, throw away 4 to get 2 and put a 1 at place 3 for 1100.

- 2 contains 2, throw away 2 to get 0 and put a 1 at place 2 for 1110.

- Now we have 0 so there is nothing more to take away.

This gives us 1110 as the binary representation of the decimal number 14.



Now let's add 29 to 14 in binary. Using the same method, we get 29 to be 11101 in binary. Now we add as follows:

- Compare the digits at place 1, get 0 and 1, add to get 1 and put that in place 1 for 1.

- Compare the digits at place 2, get 1 and 0, add to get 1 and put that in place 2 for 11.

- Compare the digits at place 3, get 1 and 1, add to get 10, put a 0 in place 3 for 011 and carry the 1.

- Compare the digits at place 4 and the carry, get 1, 1 and 1, add to get 11, put a 1 in place 4 for 1011 and carry the 1.

- Compare the digits at place 5 and the carry, get 1, 0 and 1, add to get 10, put a 0 in place 5 for 01011 and carry the 1.

- All the original digits above place 5 were 0, so put the carried 1 in place 6 for 101011.

So 29+14 translates to binary as 1110+11101 and the answer to this is 101011. Converting back into decimal, we see that this equals 43 exactly as intended.



>How can simple zeros and ones tell a computer what to do?



That is taken care of on a hardware level. Simply put, a computer has two main components, the processor and the memory. The processor stores values in sections called 'registers' located in hardware outside of memory. One of those registers contains a memory address for the next instruction. On each cycle, the processor looks into memory at that address, retrieves the information stored there, interprets that information in a way defined by the hardware in order to (possibly) carry out some single instruction, and finally increments the value in the aforementioned register by 1. Then the next cycle is started, and so on. A typical modern computer executes several billion of these cycles every second.



>Do any programmers learn binary, or is something like C++ perfectly capable of allowing for lots of programming opportunities without going any lower level.



C++ is very powerful, more powerful than some other common languages like Java. Just about anything you need to do can be done in C++. And 99.9% of the time a programmer in the real world spends writing code, they will be writing it in some higher-level language like C++, C, Java, PHP, or whatever.



However, there are still cases when programmers may need to use Assembly code, and any professional programmer will have some understanding of some Assembly language. Assembly is not literal 1s and 0s as the processor reads them, but it is very close; it is basically an abstracted version of machine code (the real 1s and 0s), such that each line of Assembly corresponds to exactly a single machine code instruction. And occasionally, a programmer may need to know the machine language as well, particularly if they are trying to hack into a system.
2010-08-17 21:09:10 UTC
1) "Binary code" works the same way "decimal code" works - it's just a different way to represent a number.



2) The instructions for a computer are just that - instructions. One "binary code" may tell the computer to take the next 2 binary codes, add them and put the result in a certain register. Another one may tell the computer to go to a certain memory address and run the code there until it hits a "return" instruction, then come back.



3) First you learn programming, THEN you learn languages. (People who learn languages without learning programming first are fooling only themselves. When you get a programming question on a job interview, you don't get the job.)



4) Most programmers don't know any binary code (machine code) at all, but many programmers know assembly (the human-readable representation of machine code). Knowing only one language is like a carpenter knowing only one tool. It's difficult to nail boards together with a coping saw and you can't write a website in C++.
2016-01-16 10:20:42 UTC
Trading binary options online is not as complicated as many people think it is. Read here https://tr.im/OptionsTradingStrategies



You don’t have to be an economics expert in order to make money by trading binary options. The charts allow you to predict the future course of an asset by finding patterns in its past price movements, and after all this what we need to win a binary trade.



Don't be intimidated by the charts, actually they are not that hard to read and understand. Strategies that are based on reading and analyzing charts are part of the technical analysis area.
Greater Meridian
2010-08-17 23:12:07 UTC
For the binary codes which get fed to the Intel processors based on the x86 instruction set, you can see the following description, which covers the Operation Code byte and Addressing Mode byte in detail:
2014-09-01 11:21:19 UTC
Hi there,

If you want to earn money with binary trading and you aren't a big expert you definitely need some kind of support. I use a software called "autobinary signals" and I earning good money with it. Here you can find all the details and also some video proofs: http://www.goobypls.com/r/rd.asp?gid=551
?
2010-08-17 21:05:04 UTC
http://www.teach-ict.com/gcse/hardware/bits_and_bytes/alphabet_binarycode.htm



Like that, but there are many more combinations for all the symbols ect. Used in scripts/programming.

Im sure you can figure it out for yourself, or be smart and use GOOGLE TO FIND OUT instead of WASTING YOUR TIME here.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...