Digital circuits work on the basis of a transistor being used as a switch. Consider a light switch, a transistor can be considered almost the same and in some circuits transistors are used to control large amounts of power with very little input power being used.
Look at figure 1 below. Here are two crude transistor switch circuits. In the first circuit if there is no voltage applied to the base of Q1 then it is not switched "on" and accordingly the + 5V passing through the 10K load resistor from our + 5V supply appears at both the collector of the transistor and also at output 1.
If we apply + 5V to the base of Q1 then because it is greater than 0.7 V than the grounded emitter, see the topic "transistors" for much greater detail on that operation, Q1 will switch on just like a light switch causing the + 5V from our supply to drop entirely across the 10K load resistor. This load could also be replaced by a small light bulb, relay or LED in conjunction with a resistor of suitable value. In any event the bulb or led would light or the relay would close.
The basic principle in digital basics is that we have just created an "electronic switch" where the positive voltage on the base produces zero voltage at the output and zero voltage on the input produces the + 5V on the output.
The output is always the opposite to the input and in digital basics terms this is called an "inverter" a very important property. Now looking at Q2 and Q3 to the right of the schematic we simply have two inverters chained one after the other. Here if you think it through the final output 2 from Q3 will always follow the input given to Q2. This in digital basics is your basic transistor switch.
Depending upon how these "switches" and "inverters" are arranged in integrated circuits we are able to obtain "logic blocks" to perform various tasks. In figure 2 we look at some of the most basic logic blocks.
In the first set of switches A, B, and C they are arranged in "series" so that for the input to reach the output all the switches must be closed. This may be considered an "AND-GATE".
In the second set of switches A, B, and C they are arranged in "parallel" so that for any input to reach the output any one of the switches may be closed. This may be considered an "OR-GATE".
These are considered the basic building blocks in digital logic. If we added "inverters" to either of those blocks, called "gates", then we achieve a "NAND-GATE" and a "NOR-GATE" respectively.
Here in figure 3 we examine the digital basics in schematic form.
Now here we have depicted four major logic blocks AND-GATE, NAND-GATE, OR-GATE and NOR-GATE plus the inverter. Firstly the "1's" and the "0's" or otherwise known as the "ones" and "zeros". A "1" is a HIGH voltage (usually the voltage supply) and the "0" is no voltage or ground potential. Other people prefer designating "H" and "L" for high and low instead of the "1's" and the "0's". Stick with which system you feel most comfortable.
Several interesting points emerge here. Of interest to the next section on binary numbers is the pattern of all the inputs for each logic block. Not only are they identical but, for only two inputs A and B there are four possible output situations which are called "states". These are digital basics. There actually can be many numbers of inputs. An eight input NAND-GATE is a common and quite useful digital logic block.
Next of particular interest is if you study them very carefully, that for the very identical inputs, each of these logic blocks gives us a totally different output result. Compare them.
Finally for the same inputs the NOR-GATE outputs are the direct opposite to the AND-GATE outputs while the OR-GATE outputs are the direct opposite to the NAND-GATE outputs.
If you have a single switch or input you can have two possible input states, it is either on or off. With two switches or inputs you have four possible input states as shown above. If you go to three inputs you have eight possible states and four inputs give you sixteen states. Again digital basics.
By adding another input you double the previous number of states. Doubling the inputs gives you the square of the states.
We say four inputs gives sixteen states so doubling that gives us eight inputs so the number of states should be 16 X 16 or 256.
Consider this. If I offered you a job and I made you two alternative offers for monthly payment - Offer No. 1 is to pay you a most generous $10,000.00 for the month. Offer No. 2 is to pay you one cent for the first day you work for me, two cents the next day and doubling each day thereafter for the whole 30 day month. Which offer would you accept? Answer at the very bottom of this page.
Binary Coded Decimal
To the right we have provided a table of BCD data which is all based upon the old "1's" and "0's".
If at first it looks a bit intimidating don't worry you will very quickly get the hang of it. Notice first of all we have in the extreme right hand column the numbers 0 - 9 and the letters A to F. The first four columns are headed 8 - 4 -2 - 1
We explained earlier by adding switches you double the previous capacity for numbering in binary. Notice the pattern of our 0's and 1's. Under the column 1 we get a succession of 0, 1, 0, 1..... Under the column 2 we get a succession of 0, 0, 1, 1..... etc.
In fact under every column heading you have exactly an equal number of zeros first followed by the same number of ones. Look at column 8 for example. Eight zeros followed by eight ones.
Now look at the far right column and look up number seven, follow that row reading across right to left and you will see the sequence 0 - 1 - 1 - 1. Okay if a one means a turned on switch with the value of that column what does 4 + 2 + 1 =?
Of course the answer was seven. Try it with any number you like. Alright what's this A to F stuff? Look at a digit on a digital clock or watch for example. For those numbers to be represented in digital format requires four switches but now we will start using the correct terms. The word is "bits", heard that before? Now we're right into digital basics.
Four bits are called "a nibble" and guess what?, eight bits are called "a byte". Bet you've heard that one for sure unless you live under a rock.
You should know by now that four switches (OK bits right!) can represent sixteen states and with a digital clock you only go 0 to 9 and don't need anything else so that was called BCD or Binary Coded Decimal. The last word is because we humans count in decimal format or decades. Digital devices including computers DON'T, they can't. All they see are ones and zeros, nothing else.
Early computer programmers needed the digital basics to some way represent the human recognised numbers 10 to 15 under the decimal system in a way which still represented one decade. They conveniently chose A - F the first six letters of the alphabet and six in latin is "HEX". Hex-Decimal was born, six alphabetical characters with ten decimal numbers comprising a set of sixteen unique settings of bits all told. The first home computers such as my old personal favourite, the Apple II, had an eight bit "data bus" which dealt in "bytes" and had a sixteen bit (65,536 or 64K) "address bus".
The only changes since the 1970's has been the ever increasing speed of the digital logic blocks contained within microprocessors, repeated doubling of the number of switches, (er sorry bits!) reduced power consumption for efficiency, and expanded on board "instruction sets" of micro-code for sharp programmers to use. Dead simple really.
By the way, computers and other digital devices can NOT multiply or divide, they can only add and subtract or shift a sequence of bits left or right. When a computer ostensibly multiplies 3 X 4 it actually deep down in the nitty gritty department of all those basic logic blocks shown in figure 3 above, which are buried deep within your IBM or Mac microprocessor, takes the number four, adds four again and; finally adds four again to get twelve. Anyone who tells you otherwise reveals a deep ignorance of digital basics, trust me.
Want more proof? Take the word "proof". In ASCII format the word "proof" in lower case is five letters of the alphabet represented as a sequence of hex-decimal bytes as follows -
A computer looks at those sequence of bytes to "interpret" the word "proof". To achieve that colour change to red I used the html instruction <font color="#FF0000"> which of course is a six byte instruction in hex-decimal. As an exercise for yourself see if you can see how the conversion from hex-decimal to decimal equivalent for the word "proof" occurs. O.K. it's just digital basics.
Digital Works 3.04
Digital Works 3.04 is a circuit simulator for Microsoft Windows written by D. J. Barker at the University of Teesside. This is a demo version of the program. You may use it without any obligation, and you may give unmodified copies of it to others. A licensed version is available in the SPSU labs.
Digital Works 3.04
NEW! - How to link directly to this page
Want to create a page link to me from your site? It couldn't be easier. No HTML knowledge required; even the technophobes can do it. All you need to do is copy and paste, the following code. All links are greatly appreciated; I sincerely thank you for your support.
Copy and paste the following code for a text link:
and it should appear like this:
href="https://www.electronics-tutorials.com/basics/digital-basics.htm" target="_top">visit Ian Purdie VK2TIP's "Digital Basics" Page</a>
visit Ian Purdie VK2TIP's "Digital Basics" Page
and it should appear like this:
the author Ian C. Purdie, VK2TIP of www.electronics-tutorials.com asserts the moral right to
be identified as the author of this web site and all contents herein. Copyright © 2000, all rights reserved. See copying and links.
These electronic tutorials are provided for individual private use and the author assumes no liability whatsoever for the application, use, misuse, of any of these projects or electronics tutorials that may result in the direct or indirect damage or loss that comes from these projects or tutorials. All materials are provided for free private and public use.
Commercial use prohibited without prior written permission from www.electronics-tutorials.com.
Copyright © 2000, all rights reserved. URL - https://www.electronics-tutorials.com/basics/digital-basics.htm
Updated 15th May, 2000
Starting at one cent, then two, then four...... after 30 days you would have been paid a total of $10,737,418.23 that's over 10 million dollars!!!!!!