Tải bản đầy đủ (.docx) (67 trang)

English for mechatronics engineering

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (4.45 MB, 67 trang )

TABLE OF CONTENTS

PART 1: DIGITAL LOGIC
CHAPTER 1: INTRODUCTION
Many control systems are concerned with setting events in motion or stopping them
when certain conditions are met. For example, with domestic washing machine, the heater is
only switched on when there is water in the drum and it is to the prescribed level. Such
control involves digital signals where there are only two possible signal levels. Digital
circuitry is the basis of digital computers and microprocessor controlled systems. There are
two input signals which are either 1 or 0 signals and an output signal which is 1 or 0 signal.
The controller is here programmed to only give a 1 output if both the input signals are 1.
Such an operation is said to be controlled by a logic gate .Logic gate is the basic building
blocks for digital electronic circuits. The term combinational logic is used for the combining
of two or more basic logic gates to form a required function.
LOGIC GATES
Logic gates are the basic components in digital electronics. They are used to create
digital circuits and even complex integrated circuits. For example, complex integrated
circuits may bring already a complete circuit ready to be used – microprocessors and
microcontrollers are the best example – but inside them they were projected using several
logic gates. In this tutorial we will teach you everything you need to know about logic gates,
with several examples.
As you may already know, digital electronics accept only two numbers, “0” and “1.”
Zero means a 0 V voltage, while “1” means 5 V or 3.3 V on newer integrated circuits. You
can think “0” and “1” as a light bulb turned off or on or as a switch turned off or on.
English for Mechatronics Engineering Page 1

English for Mechatronics Engineering Page 1

a. AND gate: Suppose we have a gate giving a high output only when both input A and
input B are high; for all other conditions it gives a low output. This is an AND logic gate.
We can visualize the AND gate as an electric circuit involving two switches in series.


Only when switch A and B are closed, there is a current.

(a) Represented by switches (b) Symbols

The relationship between the inputs and the outputs of an AND gate can be expressed in
the form of an equation, called Boolean equation. The Boolean equation for the AND gate is
written as
A . B = Y
An example is a burglar alarm in which it gives an output, the alarm sounding, when the
alarm is switched on and when a door is opened to active a sensor.
The relationships between inputs to a logic gate and the outputs can be tabulated in a
form known as truth table. This specifies the relationships between the inputs and outputs.
We can write the truth table as
A B Output
0 0
0 1
1 0
1 1

English for Mechatronics Engineering Page 2

English for Mechatronics Engineering Page 2

b. OR gate: An OR gate with inputs A and B gives an output of a 1 when A or B is 1.
We can visualize such a gate as an electric circuit involving two switches in parallel. When
switch A or B is closed, then there is a current. OR gates can also have more than inputs.
We can write the Boolean equation for an OR gate as: A
+ B = Y



(a) Represented by switches (b) Symbols


A B Output
0 0
0 1
1 0
1 1

c. NOT gate: a NOT gate has just one input and one output, giving a 1 output when the
input is 0 and a 0 when input is 1. The NOT gate gives an output which is the inversion of
the input and is called an inverter. The 1 representing NOT actually symbolizes logic
identity, i.e. no operation, and the inversion is depicted by the circle on the output. Thus, if
we have a digital input which varies with time, the output variation with time is the inverse.
The Boolean equation describing the NOT gate is
English for Mechatronics Engineering Page 3

English for Mechatronics Engineering Page 3

Input Output
1
0
AY
A bar over a symbol is used to indicate that the inverse, or complement, is being taken;
thus the bar over the A indicates that the output Y is the inverse value of A.


d. NAND gate: The NAND gate can be considered as a combination of an AND gate
followed by a NOT gate. Thus when input A is 1 and input B is 1, there is an output of 0, all
other inputs giving an output of 1.

The NAND gate is just the AND gate truth table with the outputs inverted. An alternative
way of considering the gate is as an AND gate with a NOT gate applied to invert both the
inputs before they reach the AND gate. The figure below shows the symbols used for the
NAND gate, being the AND symbol followed by the circle to indicate inversion.

The Boolean equation describing the NAND gate is:
ABY

The following is the truth table:
A B Output
0 0
0 1
1 0
1 1

English for Mechatronics Engineering Page 4

English for Mechatronics Engineering Page 4

e. NOR gate: The NOR gate can be considered as a combination of an OR gate
followed by a NOT gate. Thus when input A or input B is 1 there is an output of 0. It is just
the OR gate with the outputs inverted. An alternative way of considering the gate is as an
OR gate with a NOT gate applied to invert both the inputs before they reach the OR gate.
The figure below shows the symbols used for the NOR gate; it is the OR symbol followed
by the circle to indicate inversion.

The Boolean equation for NOR gate is:
ABY



The following is the truth table for the NOR gate.
A B Output
0 0
0 1
1 0
1 1

f. XOR gate: XOR stands for exclusive OR. XOR gate compares two values and if
they are different its output will be “1.” XOR operation is represented by the symbol ⊕. So
Y = A ⊕ B is the Boolean equation for the XOR gate.

The following is the truth table for the XOR gate.
A B Output
0 0
0 1
English for Mechatronics Engineering Page 5

English for Mechatronics Engineering Page 5

1 0
1 1

g. XNOR gate: XNOR stands for exclusive NOR and is an XOR gate with its output
inverted. So, its output is at “1” when the inputs have the same value and “0” when they are
different. XNOR operation is represented by the symbol (·). The Boolean equation for
XNOR gate is:
A (·) B = Y






CHAPTER 2: APPLICATIONS OF LOGIC GATES
INTEGRATED CIRCUIT
Logic gates are available as integrated circuits. The different manufacturers have
standardized their numbering schemes so that the basic part numbers are the same regardless
of the manufacturer. For example, Fig. 1(a) shows the gate systems available in integrated
circuit 7408; it has four two-input AND gates and is supplied in a 14-pin package. Power
supply connections are made to pins 7 and 14, these supplying the operating voltage for all
four AND gates. In order to indicate at which end of the package pin 1 starts, a notch is cut
between pins 1 and 14. Integrated circuit 7411 has three AND gates which each having
three inputs; integrated circuit 7421 has two AND gates with each having four inputs.
Figure 1(b) shows the gate systems available in integrated circuit 7402. This has four two-
input NOR gates in a 14-pin package, power connections being to pins 7 and 14. Integrated
circuit 7427 has three gates with each having three inputs.
English for Mechatronics Engineering Page 6

English for Mechatronics Engineering Page 6

A3
B3
A2
B2
A1
B1
A0
B0
A = B

Figure 2: Compar ator


Figure 1: Integrated circuit (a) 7408, (b) 7402

APPLICATIONS
1. Digital comparator
A digital comparator is used to compare two digital words to determine if they are
exactly equal. The two words are compared bit by bit and a 1 output given if the words are
equal. To compare the equality of two bits, an XOR gate can be used; if the bits are both 0
or both 1 the output is 0, and if they are not equal the output is a 1. To obtain a 1 output
when the bits are the same we need to add a NOT gate, this combination of XOR and NOT
being termed an XNOR gate. To compare each of the pairs of bits in two words we need an
XNOR gate for each pair. If the pairs are made up of the same bits then the output from
each XNOR gate is a 1. We can then use an AND gate to give a 1 output when all the
XNOR outputs are ones. Figure 2 shows the system.
English for Mechatronics Engineering Page 7

English for Mechatronics Engineering Page 7

AMB ER
A
R ED
B
G R E EN

F i gure 3: T he tr affi c l ig hts
2. Coder
The Fig. 3 shows a simple system by which a controller can send a coded digital signal
to a set of traffic lights so that the code determines which light, RED, AMBER OR GREEN,
will be turned on. To illuminate the RED light we might use the transmitted signal A = B =
0, for the AMBER light A = 0, B = 1 and for the GREEN light A = 1, B = 0. We can switch

on the lights using these codes by using three AND gates and two NOT gates.




English for Mechatronics Engineering Page 8

English for Mechatronics Engineering Page 8

CHAPTER 3: BASIC ELECTRONIC COMPONENTS
RESISTANCE
The electrical resistance of an object is a measure of its opposition to the passage of a
steady electric current. An object of uniform cross section will have a resistance proportional
to its length and inversely proportional to its cross-sectional area, and proportional to the
resistivity of the material.
Discovered by Georg Ohm in the late 1820s, electrical resistance shares some conceptual
parallels with the mechanical notion of friction. The SI unit of electrical resistance is the
ohm, symbol Ω. Resistance's reciprocal quantity is electrical conductance measured in
Siemens, symbol S.
The resistance of a resistive object determines the amount of current through the object
for a given potential difference across the object, in accordance with Ohm’s laws:
I  V
R
where
R is the resistance of the object, measured in ohms, equivalent to J·s/C
2

V is the potential difference across the object, measured in volts
I is the current through the object, measured in amperes
We all know that voltmeter and ammeter are used for measuring the voltage and the

current respectively. For the resistance, the meters that use to measure it is the ohmmeter.
But what if we don't have an ohmmeter to use?
Color coding system for resistors consists of three colors to indicate the resistance value
in ohms of a certain resistor, sometimes the fourth color indicate the tolerance value of the
resistor. By reading the color coded in correct order and substituting the correct value of
each corresponding color coded as shown in the table below, you can immediately tell all
you need to know about the resistor. Each color band represents a number and the order of
the color band will represent a number value. The first 2 color bands indicate a number. The
3
rd
color band indicates the multiplier or in other words the number of zeros. The fourth band
English for Mechatronics Engineering Page 9

English for Mechatronics Engineering Page 9

indicates the tolerance of the resistor. In most cases, there are 4 color bands. However,
certain precision resistors have 5 bands or have the values written on them, refining the
tolerance value even more.

Color
1st
Band
2nd
Band
3rd
Band
4
th
band
(multiplier)

5
th
Band
(Tolerance)
Black 0 0 0 10
0


Brown 1 1 1 10
1


Red 2 2 2 10
2


Orange 3 3 3 10
3


Yellow 4 4 4 10
4


Green 5 5 5 10
5


Blue 6 6 6 10
6



Violet 7 7 7 10
7


Gray 8 8 8 10
8


White 9 9 9 10
9





CAPACITOR
A capacitor (formerly known as condenser) is a passive two-terminal electrical
component used to store energy in an electric field. The forms of practical capacitors vary
widely, but all contain at least two electrical conductors se parated by a dielectric (insulator);
for example, one common construction consists of metal foils separated by a thin layer of
insulating film. Capacitors are widely used as parts of electrical circuits in many common
electrical devices.
When there is a potential difference (voltage) across the conductors, a static electric field
develops across the dielectric, causing positive charge to collect on one plate and negative
charge on the other plate. Energy is stored in the electrostatic field. An ideal capacitor is
English for Mechatronics Engineering Page 10

English for Mechatronics Engineering Page 10


characterized by a single constant value, capacitance, measured in farads. This is the ratio of
the electric charge on each conductor to the potential difference between them.
The capacitance is greatest when there is a narrow separation between large areas of
conductor; hence capacitor conductors are often called "plates," referring to an early means
of construction. In practice, the dielectric between the plates passes a small amount of
leakage current and also has an electric field strength limit, resulting in a breakdown voltage,
while the conductors and leads introduce an undesired inductance and resistance.
Capacitors are widely used in electronic circuits for blocking direct current while
allowing alternating current to pass, in filter networks, for smoothing the output of power
supplies, in the resonant circuits that tune radios to particular frequencies and for many other
purposes.
A capacitor consists of two conductors separated by a non-conductive region. The
nonconductive region is called the dielectric. In simpler terms, the dielectric is just an
electrical insulator. Examples of dielectric mediums are glass, air, paper, vacuum, and even a
semiconductor depletion region chemically identical to the conductors. A capacitor is
assumed to be s elf-contained and isolated, with no net electric charge and no influence from
any external electric field. The conductors thus hold equal and opposite charges on their
facing surfaces, and the dielectric develops an electric field. In SI units, a capacitance of one
farad means that one coulomb of charge on each conductor causes a voltage of one volt
across the device.
The capacitor is a reasonably general model for electric fields within electric circuits. An
ideal capacitor is wholly characterized by a constant capacitance C, defined as the ratio of
charge ±Q on each conductor to the voltage V between them:
English for Mechatronics Engineering Page 11

English for Mechatronics Engineering Page 11

Q
C

V





DIODE
A diode is a type of two-termin al electronic component with nonlinear resistance and
conductance (i.e., a nonlinear current–voltage characteristic), distinguishing it from
components such as two-terminal linear resistors which obey Ohm's law. A semiconductor
diode, the most common type today, is a crystalline piece of semiconductor material
connected to two electrical terminals. A vacuum tube diode (now rarely used except in some
high-power technologies) is a vacuum tube with two electrodes: a plate and a cathode.
The most common function of a diode is to allow an electric current to pass in one
direction (called the diode's forward direction), while blocking current in the opposite
direction (the reverse direction). Thus, the diode can be thought of as an electronic version of
a check valve. This unidirectional behavior is called rectification, and is used to convert
alternating current to direct current, and to extract modulation from radio signals in radio
receivers—these diodes are forms of rectifiers.
English for Mechatronics Engineering Page 12

English for Mechatronics Engineering Page 12



A Zener diode is a special kind of diode which allows current to flow in the forward
direction in the same manner as an ideal diode, but will also permit it to flow in the reverse
direction when the voltage is above a certain value known as the breakdown voltage, "Zener
knee voltage" or "Zener voltage." The device was named after Clarence Zener, who
discovered this electrical property. A Zener diode exhibits almost the same properties, except

the device is specially designed so as to have a greatly reduced breakdown voltage, the so-
called Zener voltage. By contrast with the conventional device, a reverse-biased Zener diode
will exhibit a controlled breakdown and allow the current to keep the voltage across the
Zener diode close to the Zener breakdown voltage. For example, a diode with a Zener
breakdown voltage of 3.2 V will exhibit a voltage drop of very nearly 3.2 V across a wide
range of reverse currents. The Zener diode is therefore ideal for applications such as the
generation of a reference voltage (e.g. for an amplifier stage), or as a voltage stabilizer for
low-current applications.

A diode bridge is an arrangement of four (or more) diodes in a bridge circuit
configuration that provides the same polarity of output for either polarity of input. When
used in its most common application, for conversion of an alternating current (AC) input into
direct current a (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-
English for Mechatronics Engineering Page 13

English for Mechatronics Engineering Page 13

wave rectification from a two-wire AC input, resulting in lower cost and weight as compared
to a rectifier with a 3-wire input from a transformer with a centertapped secondary winding.
The essential feature of a diode bridge is that the polarity of the output is the same
regardless of the polarity at the input. The diode bridge circuit is also known as the Graetz
circuit after its inventor, physicist Leo Graetz.




HW: Describing the basic operation of Diode Bridge?




LIGHT EMITTING DIODE
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator
lamps in many devices and are increasingly used for other lighting. Introduced as a practical
electronic component in 1962, early LEDs emitted low-intensity red light, but modern
versions are available across the visible, ultraviolet, and infrared wavelengths, with very high
brightness.
When a light-emitting diode is forward-biased (switched on), electrons are able to
recombine with electron holes within the device, releasing energy in the form of photons.
This effect is called electroluminescence and the color of the light (corresponding to the
energy of the photon) is determined by the energy gap of the semiconductor. LEDs are often
small in area (less than 1 mm
2
), and integrated optical components may be used to shape its
English for Mechatronics Engineering Page 14

English for Mechatronics Engineering Page 14

radiation pattern. LEDs present many advantages over incandescent light sources including
lower energy consumption, longer lifetime, improved robustness, smaller size, and faster
switching. LEDs powerful enough for room lighting are relatively expensive and require
more precise current and heat management than compact fluorescent lamp sources of
comparable output.
Light-emitting diodes are used in applications as diverse as replacements for aviation
lighting, automotive lighting (in particular brake lamps, turn signals, and indicators) as well
as in traffic signals. LEDs have allowed new text, video displays, and sensors to be
developed, while their high switching rates are also useful in advanced communications
technology. Infrared LEDs are also used in the remote control units of many commercial
products including televisions, DVD players, and other domestic appliances.

A seven-segment display (SSD), or seven-segment indicator, is a form of electronic

display device for displaying decim al numerals that is an alternative to the more complex
dot-matrix displays. Seven-segment displays are widely used in digital clocks, electronic
meters, and other electronic devices for displaying numerical information.
English for Mechatronics Engineering Page 15

English for Mechatronics Engineering Page 15


A seven segment display, as its name indicates, is composed of seven elements.
Individually on or off, they can be combined to produce simplified representations of the
Arabic numerals. Often the seven segments are arranged in an oblique (slanted) arrangement,
which aids readability. In most applications, the seven segments are of nearly uniform shape
and size (usually elongated hexagons, though trapezoids and rectangles can also be used),
though in the case of adding machines, the vertical segments are longer and more oddly
shaped at the ends in an effort to further enhance readability.
In a simple LED package, typically all of the cathodes (negative terminals) or all of the
anodes (positive terminals) of the segment LEDs are connected and brought out to a
common pin; this is referred to as a "common cathode" or "common anode" device. Hence a
7-segment plus decimal point package will only require nine pins (though commercial
products typically contain more pins, and/or spaces where pins would go, in order to match
industry standard pinouts).
Integrated displays also exist, with single or multiple digits. Some of these integrated
displays incorporate their own internal decoder, though most do not – each individual LED is
brought out to a connecting pin as described. Multiple-digit LED displays as used in pocket
calculators and similar devices used multiplexed displays to reduce the number of IC pins
required to control the display. For example, all the anodes of the A segments of each digit
position would be connected together and to a driver pin, while the cathodes of all segments
for each digit would be connected. To operate any particular segment of any digit, the
controlling integrated circuit would turn on the cathode driver for the selected digit, and the
anode drivers for the desired segments; then after a short blanking interval the next digit

would be selected and new segments lit, in a sequential fashion. Often in pocket calculators
English for Mechatronics Engineering Page 16

English for Mechatronics Engineering Page 16

odd results on the multi plexed display.

the digit drive lines would be used to scan the keyboard as well, providing further savings;
however, pressing multiple keys at once would produce
An LED matrix or LED display is a large, low-resolution form of dot matrix display,
useful both for industrial and commercial information displays as well as for hobbyist
human–machine interfaces. It consists of a 2-D matrix of LEDs with their cathodes joined in
rows and their anodes joined in columns (or vice versa). By controlling the flow of
electricity through each row and column pair it is possible to control each LED individually.
By scanning across rows, quickly flashing the LEDs on and off, it is possible to create
characters or pictures to display information to the user. By varying the pulse rate per LED,
the display can approximate levels of brightness. Multi-colored LEDs or RGBcolored LEDs
permit use as a full-color image display. The refresh rate is typically fast enough to prevent
the human eye from detecting the flicker.
A dot matrix display is a display device used to display information on machines, clocks,
railway departure indicators and many other devices requiring a simple display device of
limited resolution. The display consists of a matrix of lights or mechanical indicators
arranged in a rectangular configuration (other shapes are also possible, although not
common) such that by switching on or off selected lights, text or graphics can be displayed.
A dot matrix controller converts instructions from a processor into signals which turns on or
off lights in the matrix so that the required display is produced.

English for Mechatronics Engineering Page 17

English for Mechatronics Engineering Page 17




BIPOLAR JUNCTION TRANSISTOR (BJT)
A bipolar junction transistor (BJT) is a three-terminal electronic device constructed of
doped semiconductor material and may be used in amplifying or switching applications.
Bip olar transistors are so named because their operation involves both electrons and holes.
Charge flow in a BJT is due to bidirectional diffusion of charge carriers across a junction
between two regions of different charge concentrations. This mode of operation is contrasted
with unipolar transistors, such as field-effect transistors, in which only one carrier type is
involved in charge flow due to drift. By design, most of the BJT collector current is due to
the flow of charges injected from a high-concentration emitter into the base where they are
minority carriers that diffuse toward the collector, and so BJTs are classified as minority-
carrier devices.
NPN TYPE
NPN is one of the two types of bipolar transistors, consisting of a layer of P-doped
semiconductor (the "base") between two N-doped layers. A small current entering the base is
amplified to produce a large collector and emitter current. That is, an NPN transistor is "on"
when its base is pulled high relative to the emitter.
Most of the NPN current is carried by electrons, moving from emitter to collector as
minority carriers in the P-type base region. Most bipolar transistors used today are NPN,
because electron mobility is higher than hole mobility in semiconductors, allowing greater
currents and faster operation. A mnemonic device for the remembering the symbol for an
NPN transistor is not pointing in, based on the arrows in the symbol and the letters in the
name. That is, the NPN transistor is the BJT transistor that is "not pointing in".
English for Mechatronics Engineering Page 18

English for Mechatronics Engineering Page 18




PNP TYPE
The other type of BJT is the PNP, consisting of a layer of N-doped semiconductor
between two layers of P-doped material. A small current leaving the base is amplified in the
collector output. That is, a PNP transistor is "on" when its base is pulled low relative to the
emitter.
The arrows in the NPN and PNP transistor symbols are on the emitter legs and point in
the direction of the conventional current flow when the device is in forward active mode.
A mnemonic device for the remembering the symbol for a PNP transistor is pointing in
(proudly), based on the arrows in the symbol and the letters in the name. That is, the PNP
transistor is the BJT transistor that is "pointing in".
English for Mechatronics Engineering Page 19

English for Mechatronics Engineering Page 19


P-N-P Transistor



CHAPTER 4: MICROCONTROLLER
INTRODUCTION
When we have to learn about a new computer we have to familiarize about the machine
capability we are using, and we can do it by studying the internal hardware design (devices
architecture), and also to know about the size, number and the size of the registers.
A microcontroller is a single chip that contains the processor (the CPU), non-volatile
memory for the program (ROM or flash), volatile memory for input and output (RAM), a
clock and an I/O control unit. Also called a "computer on a chip," billions of microcontroller
units (MCUs) are embedded each year in a myriad of products from toys to appliances to
automobiles. For example, a single vehicle can use 70 or more microcontrollers.

English for Mechatronics Engineering Page 20

English for Mechatronics Engineering Page 20

The Intel MCS-51 (commonly referred to as 8051) is a Harvard architecture, single chip
microcontroller (µC) series which was developed by Intel in 1980 for use in embedded
systems. Intel's original versions were popular in the 1980s and early 1990s. While Intel no
longer manufactures the MCS-51, binary compatible derivatives remain popular today. In
addition to these physical devices, several companies also offer MCS-51 derivatives as IP
cores for use in FPGAs or ASICs designs.
Intel's original MCS-51 family was developed using NMOS technology, but later
versions, identified by a letter C in their name (e.g., 80C51) used CMOS technology and
consumed less power than their NMOS predecessors. This made them more suitable for
battery-powered devices.

IMPORTANT FEATURES
The 8051 architecture provides many functions (CPU, RAM, ROM, I/O, interrupt logic,
timer, etc.) in a single package
• 8-bit ALU, Accumulator and 8-bit Registers; hence it is an 8-bit microcontroller
• 8-bit data bus – It can access 8 bits of data in one operation
• 16-bit address bus – It can access 216 memory locations – 64 KB (65536 locations) each of
RAM and ROM
• On-chip RAM – 128 bytes (data memory)
• On-chip ROM – 4 kByte (program memory)
• Four byte bi-directional input/output port
English for Mechatronics Engineering Page 21

English for Mechatronics Engineering Page 21

• UART (serial port)

• Two 16-bit Counter/timers
• Two-level interrupt priority
• Power saving mode (on some derivatives)
For any electronics project the power supply plays a very important role in its proper
functioning. In this project we are using external A.C supply (220 v) as input, this high
voltage is converted into 12 Volts A.C by step down transformer, then we use voltage
regulators and filters with bridge rectifier to convert the A.C into D.C voltage. For voltage
regulation we are using LM 7805 and 7812 to produce ripple free 5 and 12 volts D.C
constant supply.
MCS-51 based microcontrollers typically include one or two UARTs, two or three timers,
128 or 256 bytes of internal data RAM (16 bytes of which are bit-addressable), up to 128
bytes of I/O, 512 bytes to 64 kB of internal program memory, and sometimes a quantity of
extended data RAM (ERAM) located in the external data space. The original 8051 core ran
at 12 clock cycles per machine cycle, with most instructions executing in one or two
machine cycles. With a 12 MHz clock frequency, the 8051 could thus execute 1 million one-
cycle instructions per second or 500,000 two-cycle instructions per second. Enhanced 8051
cores are now commonly used which run at six, four, two, or even one clock per machine
cycle, and have clock frequencies of up to 100 MHz, and are thus capable of an even greater
number of instructions per second
Features of the modern 8051 include built-in reset timers with brown-out detection,
onchip oscillators, self-programmable Flash ROM program memory, built-in external RAM,
extra internal program storage, SPI, and USB host interfaces, CAN or LIN bus, PWM
generators, analog comparators, A/D and D/A converters, RTCs, extra counters and timers,
more interrupt sources, and extra power saving modes.
POWER SUPPLY CIRCUIT
There are two things worth attention concerning the microcontroller power supply circuit:
Brown out is a potentially dangerous state which occurs at the moment the
microcontroller is being turned off or when power supply voltage drops to the lowest level
due to electric noise. As the microcontroller consists of several circuits which have different
English for Mechatronics Engineering Page 22


English for Mechatronics Engineering Page 22

operating voltage levels, this can because it’s out of control performance. In order to prevent
it, the microcontroller usually has a circuit for brown out reset built-in. This circuit
immediately resets the whole electronics when the voltage level drops below the lower limit.
Reset pin is usually referred to as Master Clear Reset (MCLR) and serves for external
reset of the microcontroller by applying logic zero (0) or one (1) depending on the type of
the microcontroller. In case the brown out is not built in the microcontroller, a simple
external circuit for brown out reset can be connected to this pin.




HOW TO START WORKING?
A microcontroller is a good-natured “genie in the bottle” and no extra knowledge is
required to use it.
In order to create a device controlled by the microcontroller, it is necessary to provide the
simplest PC, program for compiling and simple device to transfer the code from PC to the
chip itself. Even though the whole process is quite logical, there are often some queries, not
because it is complicated, but for numerous variations. Let’s take a look.
English for Mechatronics Engineering Page 23

English for Mechatronics Engineering Page 23

Writing program in assembly language
In order to write a program for the microcontroller, a specialized program in the
Windows environment may be used. It may, but it does not have to When using such a
software, there are numerous tools which facilitate the operation (simulator tool comes first),
which is an obvious advantage. But there is also another ways to write a program. Basically,

text is the only thing that matters. Any program for text processing can be used for this
purpose. The point is to write all instructions in such an order they should be executed by the
microcontroller, observe the rules of assembly language and write instructions exactly as
they are defined. In other words, you just have to follow the program idea. That’s all!
To enable the compiler to operate successfully, it is necessary that a document containing
this program has the extension, .asm in its name, for example: Program asm. When a
specialized program (mplab) is used, this extension will be automatically added. If any other
program for text processing (Notepad) is used then the document should be saved and
renamed. For example: Program.txt -> Program.asm. This procedure is not necessarily
performed. The document may be saved in original format while its text may be copied to
the programmer for further use.
Compiling a program
The microcontroller “cannot understand” the assembly language. That is why it is
necessary to compile the program into machine language. It is more than simple when a
specialized program (mplab) is used because a compiler is a part of the software. Just one
click on the appropriate icon solves the problem and a new document with .hex extension
appears. It is actually the same program, only compiled into machine language which the
microcontroller perfectly understands. Such documentation is commonly named “hex code”
and seemingly represents a meaningless sequence of numbers in hexadecimal number
system.
In the event that other software for program writing in assembly language is used, special
software for compiling the program must be installed and used as follows - set up the
compiler, open the document with .asm extension and compile. The result is the same- a new
document with extension .hex. The only problem now is that it is stored in your PC.
Programming a microcontroller
English for Mechatronics Engineering Page 24

English for Mechatronics Engineering Page 24

In order to transfer a “hex code” to the microcontroller, it is necessary to provide a cable

for serial communication and a special device, called programmer, with software. There are
several ways to do it.
A large number of programs and electronic circuits having this purpose can be found on
the Internet. Do as follows: open hex code document, set a few parameters and click the icon
for compiling. After a while, a sequence of zeros and ones will be programmed into the
microcontroller through the serial connection cable and programmer hardware. What's left is
to place the programmed chip into the target device. In the event that it is necessary to make
some changes in the program, the previous procedure may be repeated an unlimited number
of times.

Development systems
A device which in the testing program phase can simulate any environment is called a
development system. Apart from the programmer, the power supply unit and the
microcontroller’s socket, the development system contains elements for input pin activation
and output pin monitoring. The simplest version has every pin connected to one push button
and one LED as well. A high quality version has LED displays, LCD displays, temperature
sensors and all other elements which can be supplied with the target device. These
peripherals can be connected to the MCU via miniature jumpers. In this way, the whole
program may be tested in practice during its development stage, because the microcontroller
doesn't know or care whether its input is activated by a push button or a sensor built in a real
device.
English for Mechatronics Engineering Page 25

English for Mechatronics Engineering Page 25

×