
- •Table of Contents
- •Preface
- •Additional Material
- •Basic Electronics
- •1.0 The Atom
- •1.1 Isotopes and Ions
- •1.2 Static Electricity
- •1.3 Electrical Charge
- •1.4 Electrical Circuits
- •1.5 Circuit Elements
- •1.6 Semiconductors
- •Number Systems
- •2.0 Counting
- •2.1 The Origins of the Decimal System
- •2.2 Types of Numbers
- •2.3 Radix Representations
- •2.4 Number System Conversions
- •Data Types and Data Storage
- •3.0 Electronic-Digital Machines
- •3.1 Character Representations
- •3.2 Storage and Encoding of Integers
- •3.3 Encoding of Fractional Numbers
- •3.4 Binary-Coded Decimals (BCD)
- •Digital Logic, Arithmetic, and Conversions
- •4.0 Microcontroller Logic and Arithmetic
- •4.1 Logical Instructions
- •4.2 Microcontroller Arithmetic
- •4.3 Bit Manipulations and Auxiliary Operations
- •4.4 Unsigned Binary Arithmetic
- •4.5 Signed Binary Arithmetic
- •4.6 Data Format Conversions
- •Circuits and Logic Gates
- •5.0 Digital Circuits
- •5.1 The Diode Revisited
- •5.2 The Transistor
- •5.3 Logic Gates
- •5.4 Transistor-Transistor Logic
- •5.5 Other TTL Logic Families
- •5.6 CMOS Logic Gates
- •Circuit Components
- •6.0 Power Supplies
- •6.1 Clocked Logic and Flip-flops
- •6.2 Clocks
- •6.3 Frequency Dividers and Counters
- •6.4 Multiplexers and Demultiplexers
- •6.5 Input Devices
- •The Microchip PIC
- •7.0 The PICMicro Microcontroller
- •7.1 PIC Architecture
- •Mid-range PIC Architecture
- •8.0 Processor Architecture and Design
- •8.1 The Mid-range Core Features
- •8.2 Mid-Range CPU and Instruction Set
- •8.3 EEPROM Data Storage
- •8.4 Data Memory Organization
- •8.5 Mid-range I/O and Peripheral Modules
- •PIC Programming: Tools and Techniques
- •9.0 Microchip’s MPLAB
- •9.1 Integrated Development Environment
- •9.2 Simulators and Debuggers
- •9.3 Programmers
- •9.4 Engineering PIC Software
- •9.5 Pseudo Instructions
- •Programming Essentials: Input and Output
- •10.0 16F84A Programming Template
- •10.1 Introducing the 16F84A
- •10.2 Simple Circuits and Programs
- •10.3 Programming the Seven-segment LED
- •10.4 A Demonstration Board
- •Interrupts
- •11.0 Interrupts on the 16F84
- •11.1 Interrupt Sources
- •11.2 Interrupt Handlers
- •11.3 Interrupt Programming
- •11.4 Sample Programs
- •Timers and Counters
- •12.0 The 16F84 Timer0 Module
- •12.1 Delays Using Timer0
- •12.2 Timer0 as a Counter
- •12.3 Timer0 Programming
- •12.4 The Watchdog Timer
- •12.5 Sample Programs
- •LCD Interfacing and Programming
- •13.0 LCD Features and Architecture
- •13.1 Interfacing with the HD44780
- •13.2 HD44780 Instruction Set
- •13.3 LCD Programming
- •13.4 Sample Programs
- •Communications
- •14.0 PIC Communications Overview
- •14.1 Serial Data Transmission
- •14.2 Parallel Data Transmission
- •14.4 PIC Protocol-based Serial Programming
- •14.5 Sample Programs
- •Data EEPROM Programming
- •15.0 PIC Internal EEPROM Memory
- •15.1 EEPROM Devices and Interfaces
- •15.2 Sample Programs
- •Analog to Digital and Realtime Clocks
- •16.0 A/D Converters
- •16.1 A/D Integrated Circuits
- •16.2 PIC On-Board A/D Hardware
- •16.3 Realtime Clocks
- •16.4 Sample Programs
- •Index

Chapter 1
Basic Electronics
1.0 The Atom
Until the end of the nineteenth century it was assumed that matter was composed of small, indivisible particles called atoms. The work of J.J. Thompson, Daniel Rutheford, and Neils Bohr proved that atoms were complex structures that contained both positive and negative particles. The positive ones were called protons and the negative ones electrons.
Several models of the atom were proposed: the one by Thompson assumed that there were equal numbers of protons and electrons inside the atom and that these elements were scattered at random, as in the leftmost drawing in Figure 1-1. Later, in 1913, Daniel Rutheford's experiments led him to believe that atoms contained a heavy central positive nucleus with the electrons scattered randomly. So he modified Thompson's model as shown in the center drawing. Finally, Neils Bohr theorized that electrons had different energy levels, as if they moved around the nucleus in different orbits, like planets around a sun. The rightmost drawing represents this orbital model.
|
- |
|
|
|
|
|
- |
|
|
|
- |
|
|
|
|
|
+ |
|
|
|
|
|
|
+ |
|
|
|
|
|
|
|
|
|
|
|
|
|
- |
|
|
- |
- |
|
|
|
|
|
|
+ + |
|
|
|
|||
|
|
|
|
|
+ + |
||
+ |
- |
|
+ |
+ |
- |
|
|
+ |
|
+ |
- |
+ |
|||
|
|
|
|
|
+ + |
||
|
|
|
|
|
|
||
|
|
- |
|
|
|
|
|
|
- |
|
|
|
|
|
|
- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ |
|
- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- |
- |
Figure 1-1 Models of the Atom
1

2 |
Chapter 1 |
Investigations also showed that the normal atom is electrically neutral. Protons (positively charged particles) have a mass of 1.673 X 10-24 grams. Electrons (negatively charged particles) have a mass of 9.109 X 10-28 grams. Furthermore, the orbital model of the atom is not actually valid since orbits have little meaning at the atomic level. A more accurate representation is based on concentric spherical shells about the nucleus. An active area of research deals with atomic and sub-atomic structures.
The number of protons in an atom determines its atomic number; for example, the hydrogen atom has a single proton and an atomic number of 1, helium has 2 protons, carbon has 6, and uranium has 92. But when we compare the ratio of mass to electrical charge in different atoms we find that the nucleus must be made up of more than protons. For example, the helium nucleus has twice the charge of the hydrogen nucleus, but four times the mass. The additional mass is explained by assuming that there is another particle in the nucleus, called a neutron, which has the same mass as the proton but no electrical charge. Figure 1-2 shows a model of the helium atom with two protons, two electrons, and two neutrons.
-
+
+
-
Figure 1-2 Model of the Helium Atom
1.1 Isotopes and Ions
But nature is not always consistent with such neat models. Whereas in a neutral atom, the number of protons in the atomic nucleus exactly matches the number of electrons, the number of protons need not match the number of neutrons. For example, most hydrogen atoms have a single proton, but no neutrons, while a small percentage have one neutron, and an even smaller one have two neutrons. In this sense, atoms of an element that contains different number of neutrons are isotopes of the element; for example water (H2O) containing hydrogen atoms with two neutrons (deuterium) is called "heavy water."
An atom that is electrically charged due to an excess or deficiency of electrons is called an ion. When the dislodged elements are one or more electrons the atom takes a positive charge. In this case it is called a positive ion. When a stray electron combines with a normal atom the result is called a negative ion.

Basic Electronics |
3 |
1.2 Static Electricity
Free electrons can travel through matter or remain at rest on a surface. When electrons are at rest, the surface is said to have a static electrical charge that can be positive or negative. When electrons are moving in a stream-like manner we call this movement an electrical current. Electrons can be removed from a surface by means of friction, heat, light, or a chemical reaction. In this case the surface becomes positively charged.
The ancient Greeks discovered that when amber was rubbed with wool the amber became electrically charged and would attract small pieces of material. In this case, the charge is a positive one. Friction can cause other materials, such as hard rubber or plastic, to become negatively charged. Observing objects that have positive and negative charges we note that like charges repel and unlike charges attract each other, as shown in Figure 1-3.
+
+
- |
- |
+
-
Figure 1-3 Like and Unlike Charges
Friction causes loosely-held electrons to be transferred from one surface to the other. This results in a net negative charge on the surface that has gained electrons, and a net positive charge on the surface that has lost electrons. If there is no path for the electrons to take to restore the balance of electrical charges, these charges remain until they gradually leak off. If the electrical charge continues building it eventually reaches the point where it can no longer be contained. In this case it discharges itself over any available path, as is the case with lightning.
Static electricity does not move from one place to another. While some interesting experiments can be performed with it, it does not serve the practical purpose of providing energy to do sustained work.
Static electricity certainly exists, and under certain circumstances we must allow for it and account for its possible presence, but it will not be the main theme of these pages.
4 |
Chapter 1 |
1.3 Electrical Charge
Physicists often resort to models and theories to describe and represent some force that can be measured in the real world. But very often these models and representations are no more than concepts that fail to physically represent the object. In this sense, no one knows exactly what gravity is, or what is an electrical charge. Gravity, which can be felt and measured, is the force between masses.
By the same token, bodies in "certain electrical conditions" also exert measurable forces on one another. The term "electrical charge" was coined to explain these observations.
Three simple postulates or assumptions serve to explain all electrical phenomena:
1.Electrical charge exists and can be measured. Charge is measured in Coulombs, a unit named for the French scientist Charles Agustin Coulomb.
2.Charge can be positive or negative.
3.Charge can neither be created nor destroyed. If two objects with equal amounts of positive and negative charge are combined on some object, the resulting object will be electrically neutral and will have zero net charge.
1.3.1 Voltage
Objects with opposite charges attract, that is, they exert a force upon each other that pulls them together. In this case, the magnitude of the force is proportional to the product of the charge on each mass. Like gravity, electrical force depends inversely on the distance squared between the two bodies; the closer the bodies the greater the force. Consequently, it takes energy to pull apart objects that are positively and negatively charged, in the same manner that it takes energy to raise a big mass against the pull of gravity.
The potential that separate objects with opposite charges have for doing work is called voltage. Voltage is measured in units of volts (V). The unit is named for the Italian scientist Alessandro Volta.
The greater the charge and the greater the separation, the greater the stored energy, or voltage. By the same token, the greater the voltage, the greater the force that drives the charges together.
Voltage is always measured between two points that represent the positive and negative charges. In order to compare voltages of several charged bodies a common reference point is necessary. This point is usually called "ground."
1.3.2 Current
Electrical charge flows freely in certain materials, called conductors, but not in others, called insulators. Metals and a few other elements and compounds are good conductors, while air, glass, plastics, and rubber are insulators. In addition, there is a third category of materials called semiconductors; sometimes they seem to be good con-

Basic Electronics |
5 |
ductors but much less so other times. Silicon and Germanium are two such semiconductors. We discuss semiconductors in the context of integrated circuits later in the book.
Figure 1-4 shows two connected, oppositely charged bodies. The force between them has the potential for work; therefore, there is voltage. If the two bodies are connected by a conductor, as in the illustration, the positive charge moves along the wire to the other sphere. On the other end, the negative charge flows out on the wire towards the positive side. In this case, positive and negative charges combine to neutralize each other until there are no charge differences between any points in the system.
|
|
|
|
current flow |
|
|
|
|
||
|
|
+ |
|
|
|
|
||||
|
|
|
|
|
- |
|
|
|||
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
||
+ |
+ |
|
|
- |
|
- |
||||
|
|
|
|
- |
|
|
||||
+++ |
|
|
- |
- |
- |
|||||
|
|
|
|
|
|
|
|
|
|
|
+ |
+ |
|
|
- |
|
|
Figure 1-4 Connected Opposite Charges
The flow of an electrical charge is called a current. Current is measured in amperes (a), also called amps, after Andre Ampere, a French mathematician and physicist. An ampere is defined as a flow of one Coulomb of charge in one second.
Electrical current is directional; therefore, a positive current is the flow current from a positive point A to a negative point B. However, most current results from the flow of negative-to-positive charges.
1.3.3 Power
Current flowing through a conductor produces heat. The heat is the result of the energy that comes from the charge traveling across the voltage difference. The work involved in producing this heat is electrical power. Power is measured in units of watts (W), named after the Englishman James Watt, who invented the steam engine.
1.3.4 Ohm's Law
The relationship between voltage, current, and power is described by Ohm's Law, named after the German physicist Georg Simon Ohm. Using equipment of his own creation, Ohm determined that the current that flows through a wire is proportional to its cross-sectional area and inversely proportional to its length. This allowed defining the relationship between voltage, current, and power, as expressed by the equation:
P = V × I