Your Voice, Your Blog, Your Empire

Translate

Wednesday, April 6, 2011

Digital Basics

What are the digital basics?

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.

This image is copyright © by Ian C. Purdie VK2TIP - transistors as digital switches in digital basics
Figure 1. - transistors as digital switches in digital basics
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.

Logic Blocks in Digital Basics

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.

This image is copyright © by Ian C. Purdie VK2TIP - digital switches in digital basics
Figure 2. - digital switches in digital basics
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.

This image is copyright © by Ian C. Purdie VK2TIP - digital basics in schematic form
Figure 3. - 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.

Binary Numbers and Hex-Decimal in Digital Basics

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 =?
Binary Coded Decimal - BCD
8
4
2
1
 
0
0
0
0
0
0
0
0
1
1
0
0
1
0
2
0
0
1
1
3
0
1
0
0
4
0
1
0
1
5
0
1
1
0
6
0
1
1
1
7
1
0
0
0
8
1
0
0
1
9
1
0
1
0
A
1
0
1
1
B
1
1
0
0
C
1
1
0
1
D
1
1
1
0
E
1
1
1
1
F
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.


 

Introduction to transistors?

Transistors, I was once told, "were the fastest acting fuse known to mankind". This of course was a reference to the fact an early transistor was intolerant of fault conditions whereas in years gone by, vacuum tubes (valves) would cop a lot of abuse. Just remember that fact. [one of "murphy's laws" - The component exists to protect the fuse]
Generally transistors fall into the category of bipolar transistor, either the more common NPN bipolar transistors or the less common PNP transistor types. There is a further type known as a FET transistor which is an inherently high input impedance transistor with behaviour somewhat comparable to valves. Modern field effect transistors or FET's including JFETS and MOSFETS now have some very rugged transistor devices. I am often asked about the term "bipolar" - see later.

History of Transistors

The transistor was developed at Bell Laboratories in 1948. Large scale commercial use didn't come until much later owing to slow development. Transistors used in most early entertainment equipment were the germanium types. When the silicon transistor was developed it took off dramatically. The first advantages of the transistor were relatively low power consumption at low voltage levels which made large scale production of portable entertainment devices feasible. Interestingly the growth of the battery industry has paralleled the growth of the transistor industry. In this context I include integrated circuits which of course are simply a collection of transistors grown on the one silicon substrate.

How do transistors work?

Transistors work on the principle that certain materials e.g. silicon, can after processing be made to perform as "solid state" devices. Any material is only conductive in proportion to the number of "free" electrons that are available. Silicon crystals for example have very few free electrons. However if "impurities" (different atomic structure - e.g. arsenic) are introduced in a controlled manner then the free electrons or conductivity is increased. By adding other impurities such as gallium, an electron deficiency or hole is created. As with free electrons, the holes also encourage conductivity and the material is called a semi-conductor. Semiconductor material which conducts by free electrons is called n-type material while material which conducts by virtue of electron deficiency is called p-type material.

How do holes and electrons conduct in transistors?

If we take a piece of the p-type material and connect it to a piece of n-type material and apply voltage as in figure 1 then current will flow. Electrons will be attracted across the junction of the p and n materials. Current flows by means of electrons going one way and holes going in the other direction. If the battery polarity were reversed then current flow would cease.


This image is copyright © by Ian C. Purdie VK2TIP - electron flow in a p-n juction of a diode
Figure 1. - electron flow in a p-n juction of a diode
Some very interesting points emerge here. As depicted in figure 1 above a junction of p and n types constitutes a rectifier diode. Indeed a transistor can be configured as a diode and often are in certain projects, especially to adjust for thermal variations. Another behaviour which is often a limitation and at other times an asset is the fact that with zero spacing between the p and n junctions we have a relatively high value capacitor.
This type of construction places an upper frequency limit at which the device will operate. This was a severe early limitation on transistors at radio frequencies. Modern techniques have of course overcome these limitations with some bipolar transistors having Ft's beyond 1 Ghz. The capacitance at the junction of a diode is often taken advantage of in the form of varactor diodes. See the tutorial on diodes for further details. The capacitance may be reduced by making the junction area of connection as small as possible. This is called a "point contact".
Now a transistor is merely a "sandwich" of these devices. A PNP transistor is depicted in figure 2 below.


This image is copyright © by Ian C. Purdie VK2TIP - sandwich construction of a PNP transistor
Figure 2. - sandwich construction of a PNP transistor
Actually it would be two p-layers with a "thin" n-layer in between. What we have here are two p-n diodes back to back. If a positive voltage (as depicted) is applied to the emitter, current will flow through the p-n junction with "holes" moving to the right and "electrons moving to the left. Some "holes" moving into the n-layer will be neutralised by combining with the electrons. See electron theory and atoms. Some "holes" will also travel toward the right hand region.
The fact that there are two junctions leads to the term "bipolar transistor".
If a negative voltage (as depicted) is applied to the collector of the transistor, then ordinarily no current flows BUT there are now additional holes at the junction to travel toward point 2 and elctrons can travel to point 1, so that a current can flow, even though this section is biased to prevent conduction.
It can be shown that most of the current flows between points 1 and 2. In fact the amplitude (magnitude) of the collector current in a transistor is determined mainly by the emitter current which in turn is determined by current flowing into the base of the transistor. Consider the base to be a bit like a tap or faucet handle.

Transistor amplification

Because the collector current (where the voltage is relatively high) is pretty much the same as the emitter current and also controlled by the emitter current (where the voltage is usually much lower) it can be shown by ohms law
P = I 2 X R
that amplification occurs. See small signal amplifiers.

The NPN transistor

We discussed a PNP transistor above. The only differences between PNP and NPN transistors are in manufacturing (i.e. location of the p-layers and n-layers) and of much importance in the biasing. The schematic symbols for PNP and NPN transistors, (the work horse is the NPN) are shown in figure 3 below. A silicon NPN transistor needs to be forward biased by about 0.65V for it to turn on.

Historical Footnote on Transistors - [added 1st May, 2000]

This is an interesting excerpt from a post by a friend to a list I subscribe to:
"The more I think about Tesla the more it brings to mind another bright guy that got off track and missed out. His name was Shockley. I worked for him in the early days of Silicon Valley".
"He had the technology and the people to put the 'silicon transistor' on the market, BUT he was obsessed with a thing he called the "four layer diode" to be used for telephone switching. That product finally went nowhere and the guys that left Shockley and started Fairchild Semiconductor were the guys that marketed the transistor in it's first commercial silicon form".
"And the four layer diode?, finally turned out to be the SCR, a good product but not the world beater that the silicon transistor was".
[end historical footnote]
Meanwhile back to our transistor tutorial and figure 3 depicting a schematic of a PNP transistor and an NPN transistor.


This image is copyright © by Ian C. Purdie VK2TIP - schematic of PNP transistor and NPN transistor
Figure 3. - schematic of PNP transistor and NPN transistor
Notice the only difference is the location and direction of the arrows in the emitter. This denotes direction of current flow in the emitter. Note: that is not a topic I will enter into discussion as I've seen too many discussions already - I have no opinion .
Also see small signal amplifiers.
Download PDF data sheet P2N2222A - plastic bipolar transistor 238K

FET's as transistors

In figure 4 below I have depicted the schematics of the two most popular types. A J-FET and a dual gate mosfet. Typical types might be MPF-102 for a J-FET and the old RCA 40673 for the dual gate.


This image is copyright © by Ian C. Purdie VK2TIP - schematic of J-FET transistor and dual gate mosfet transistor
Figure 4. - schematic of J-FET transistor and dual gate mosfet transistor
The FET of course is characterised by its extremely high input impedance. Some people claim the FET is a superior device to a bipolar transistor. I consider that to be a subjective opinion with the proviso that FET development has led to some amazing developments, particularly with power-fets.
I won't go into any length about how FETS operate except to point out the principal differences to NPN and PNP transistors. A bipolar transistor has moderate input impedance (depending on configuration) while some FETs can and do have input impedances measured in megohms. Bipolar transistors are essentially "current" amplifiers while FETS could be considered voltage amplifiers.