Tweak3D - Your Freakin' Tweakin' Source!
Speaking the Language of Computers - How Binary Works


Posted: December 10, 2005
Written By: Dan "Tweak Monkey" Kennedy

The advice contained in this article is free for use at your own risk. If you can't benefit from this article, please pass it on to someone who can and view our other articles. For technical support, visit the Tweak3D Forums.



Introduction

You will never truly master computers until you can clearly communicate their language.

If you only speak one language you will have less opportunities and options in life than if you spoke more. By acquiring the ability to communicate with more people, you open new doors for business opportunities and relationships. Given this fact, it makes sense that you would benefit from the ability to communicate with anything. Electronics and computers, which are becoming more important to daily life at an exponential rate, have their own language and it is important that you understand it.

At the lowest level, computers communicate in a simple language called Binary. While the language can be taught in a few minutes, most people won't really learn it for years. I was first taught binary several years ago, but through wisdom acquired while programming with assembly, a low-level programming language, I truly learned the language a few years later.

It is critical that anyone hoping to understand, repair, and troubleshoot computers has a complete understanding of this language. It is the most important fundamental topic to grasp with computers and will ultimately determine your success with them.

Lesson 1: Vocabulary

The binary language is so simple! It only consists of two words: 1 or 0 (also known as On or Off, and Yes or No ).
1 = On
0 = Off
Even though binary only has two words, they can be used to represent anything. The numbers can be used to represent other numbers, which can represent data, and so-on. We'll explain how later.

So 1 = On and 0 = Off. What does this really mean?

Lesson 2: Representing Logic with Binary

Binary represents everything as an on/off switch. Look at a light switch and imagine it says 1 at the top and 0 at the bottom. Take this question: Is the light on? The position of the switch answers the question. If the switch is flipped to 0, the answer is No - the light is Off. If it's not off, it must be on.

   
Switch set to 0                                                      Switch set to 1


Here's a sample computer program for controlling the light switch:
integers switch, light;    // variables representing state of switch and light
switch = off;                  // initialize switch to off position
light = off;                     // initialize the light to off
LightStatus(){               // a function to represent status of the light
if (switch == 1)             // if the switch is turned on
       light = 1;                // then the light turns on
else                 //otherwise the switch is off
       light = 0;                // so the light is turned off
}
The value of the light switch is checked by the function LightStatus. When it's On (switch = 1) it turns the light On (light = 1). Binary can be used to represent the answer to any Yes or No question. Is the light on? Check the value of the variable light for the answer. This is exactly how software determines the answer to a question and at a lower-level, how the hardware knows what it is supposed to be doing.

In front of you there is a computer monitor. There is a light at the corner of this monitor representing its status. Usually green light = on, amber light = standby, and no light = off. Hard-coded electronically into the monitor is a circuit that tells the light what to do. It asks two questions: Is the monitor switched on? and Is the monitor in standby mode? If the answer to the first question is No (or Off, 0) [determined by another circuit], this circuit sends it no power and the light stays off. Otherwise it moves to the second question and determines whether to illuminate the green or amber light.

Representing numbers in binary allows unlimited application of this logic.

Next Page - Representing and Manipulating Numbers in Binary

  • News
  • Forums
  • Tweaks
  • Articles
  • Reviews