Beruflich Dokumente
Kultur Dokumente
CHAPTER-1
COMPANY PROFILE
COMPANY PROFILE
Sofcon India Pvt. Ltd (ISO 9001-2008 & IAO-International Accreditation Organization
accredited Company) imparts practical Training to Fresh Engineers / Working Professionals /
Technicians on:
Embedded Systems : 8051, PIC, AVR Micro Controllers , ARM, RTOS
Electrical Systems
Summer / Winter / Project Training with project Guidance for II/III/Final year
Engineering/Diploma Students
RESOURCES:
Qualified & Dedicated Training Staff
Specialized Consultants & Expert Advisors from Industry & Reputed Institutes
Team for In-house Research & Development
Placement cell for industry-academic interaction
CHAPTER -2
2.1
Embedded System
2.3
Microprocessor (MPU)
RAM
ROM
I/O Port
Timer
2.4
Microcontroller (MCU)
Serial
COM
Port
2.5
10
11
1 Hardware
Power Supply
Processor
Memory (RAM, ROM)
Timers
Serial communication ports
Input/output circuits
System application specific circuits
2 Software:
12
13
14
Assembly Language:
An assembly language is a list of processor instructions written in a symbolic,
human-readable form. Each instruction consists of an operation such as addition
along with some operands. E.g., add r5, r2, r4 might add the contents of registers r2
and r4 and write the result to r5. Such arithmetic instructions are executed in order,
but branch instructions can perform conditionals and loops by changing the
processors program counter the address of the instruction being executed.
A processors assembly language is denes by its Opcodes, addressing modes,
registers, and memories. The Opcode distinguishes, say, addition from conditional
branch, and an addressing mode denes how and where data is gathered and stored
(e.g., from a register or from a particular Memory location). Registers can be
thought of as small, fast, easy-to-access pieces of memory.
Embedded C:
A C program contains functions built from arithmetic expressions structured with
loops and conditionals.
Instructions in a C program run sequentially, but control ow constructs such as
loops of conditionals can affect the order in which instructions execute. When
control reaches a function call in an expression, control is passed to the called
function, which runs until it produces a result, and control returns to continue
evaluating the expression that called the function. C derives its types from those a
15
processor manipulates directly: signed and unsigned integers ranging from bytes to
words, oating point numbers, and pointers. These can be further aggregated into
arrays and structuresgroups of named elds.
16
CHAPTER - 3
17
18
Resistor
Capacitor
Diodes
Transistor
Basic ICs
Bread boarding of circuits
3.1 Resistor
Two-terminal non-polarized electronic component Limits or regulates the flow of
electrical current in an electronic circuit Resistors can also be used to provide a
specific voltage for an active device such as a transistor
Resistors restrict the flow of electric current, for example a resistor is placed in
series with a light-emitting diode (LED) to limit the current passing through the
LED. Connecting and soldering Resistors may be connected either way round.
They are not damaged by heat when soldering.
Resistor values - the resistor colour code
Resistance is measured in ohms; the symbol for ohm is an omega. 1 is quite small
so resistor values are often given in k and M. 1 k = 1000 1 M = 1000000.
Resistor values are normally shown using colored bands. Each colour represents a
number as shown in the table.
Most resistors have 4 bands:
The first band gives the first digit.
19
The
second band
gives
the
second
digit.
The third band indicates the number zeros.
The fourth
the tolerance
resistor, this
almost all
details are
20
3.2 Capacitor
Capacitive filters are used stabilized or perfect regulation of the voltage. The
capacitive filters are opted because, they are more efficient. But they are also more
costly.
Different types of capacitors are:
1. Ceramic capacitors.
2. Electrolyte capacitors.
3. Paper/Mica capacitors.
4. Silver capacitors.
5. Tantalum capacitors.
Ceramic, Paper/Mica, Silver are non polarized capacitors. Electrolyte and
Tantalum are polarized capacitors. For high frequency, Ceramic capacitors are
used. For low frequencies, Electrolyte capacitors are used.
21
Polarized Capacitor
Non-polarized Capacitor
22
Fig. un polarized
Capacitor
Small value capacitors are un polarised and may be connected either way round.
They are not damaged by heat when soldering, except for one unusual type
(polystyrene). They have high voltage ratings of at least 50V, usually 250V or so. It
can be difficult to find the values of these small capacitors because there are many
types of them and several different labeling systems
Many small value capacitors have their value printed but without a multiplier, so
you need to use experience to work out what the multiplier should be!
For example 0.1 means 0.1F = 100nF. Sometimes the multiplier is used in place
of the decimal point: For example: 4n7 means 4.7nF.
Capacitor Number Code:
A number code is often
used on small capacitors
where printing is
difficult:
23
For example: 102 means 1000pF = 1nF (not 102pF!) For example: 472J
means 4700pF = 4.7nF (J means 5%
3.3 Diodes
Diode is an electronic component which permits the flow of current in one
direction only. Diodes are made up of semiconductor material; therefore they are
often called semiconductor diodes or crystal diodes
Types of diodes
1
forward bias.
24
3.4 Transistor
25
A transistor is
a semiconductor device used
to amplify and switch electronic signals and electrical power. It is composed
of semiconductor material with at least three terminals for connection to an
external circuit. A voltage or current applied to one pair of the transistor's terminals
changes the current through another pair of terminals. Because the controlled
(output) power can be higher than the controlling (input) power, a transistor
can amplify a signal. Today, some transistors are packaged individually, but many
more are found embedded in integrated circuits.
It
is
a
Semiconductor device used
to
amplify
and
switch electronic signals.Transistor is three terminals for connection to an external
circuit. One terminal can be use to control the flow of current through the other
two terminals.The three terminals are Emitter, Base and Collector
Types of Transistor
n-p-n transistors :-A straight switch
26
L293D:
L293D is a dual H-Bridge motor driver.
With one IC we can interface two DC motors which can be controlled in
both clockwise and counter clockwise direction
If you have motor with fix direction of motion then you can make use of all
the four I/Os to connect up to four DC motors.
Moreover for protection of circuit from back EMF output diodes are included
within the IC.
27
VCC
555 IC
28
Bistable Mode
In this mode, the IC has two stable states. In Bistable mode, the 555 timer acts as a
basic flip-flop. The trigger and reset inputs (pins 2 and 4 respectively on a 555) are
held high via Pull-up resistors while the threshold input (pin 6) is simply grounded.
Thus configured, pulling the trigger momentarily to ground acts as a 'set' and
transitions the output pin (pin 3) to Vcc (high state). Pulling the reset input to
ground acts as a 'reset' and transitions the output pin to ground (low state).
29
Astable Mode
In this mode, the IC not having a single stable state. Astable mode, the 555 timer
puts out a continuous stream of rectangular pulses having a specified frequency.
Resistor R1 is connected between VCC and the discharge pin (pin 7) and another
resistor (R2) is connected between the discharge pin (pin 7), and the trigger (pin 2)
and threshold (pin 6) pins that share a common node. Hence the capacitor is
charged through R1 and R2, and discharged only through R2, since pin 7 has low
impedance to ground during output low intervals of the cycle, therefore
discharging the capacitor
LM358 IC
30
IC 7805
The 78xx (sometimes LM78xx) is a family of self-contained fixed linear voltage
regulator integrated circuits. The 78xx family is commonly used in electronic
circuits requiring a regulated power supply due to their ease-of-use and low cost.
For ICs within the family, the xx is replaced with two digits, indicating the
output voltage (for example, the 7805 has a 5 volt output, while the 7812 produces
31
12 volts). The 78xx line is positive voltage regulators: they produce a voltage that
is positive relative to a common ground. There is a related line of 79xx devices
which are complementary negative voltage regulators. 78xx and 79xx ICs can be
used in combination to provide positive and negative supply voltages in the same
circuit.
Almost all the Electronics Club projects started life on a breadboard to check
that the circuit worked as intended
Internals connection of breadboard
The top and bottom rows are linked horizontally(up to consecutive 25
holes) all the way across as shown by the
red and black lines on the
diagram
The other holes are linked vertically in blocks of 5 with no link across the
centre as shown by the blue lines on the diagram
Connections on Breadboard
Breadboards have many tiny sockets (called 'holes') arranged on a 0.1" grid.
The leads of most components can be pushed straight into the holes
32
notch or dot to the left. Wire links can be made with single-core plasticcoated wire of 0.6mm diameter (the standard size)
Stranded wire is not suitable because it will crumple when pushed into a
hole and it may damage the board if strands break off
Breadboard implementation of some circuits:-
Fig.: OR Gate
33
Fig.: Light Sensor
34
CHAPTER - 4
8051 ARCHITECTURE
35
36
37
38
applying logic zero to this pin, the program starts execution from the beginning.
Pin 9 is the RESET pin. It is an input and is active high. Upon applying a high
pulse to this pin the microcontroller well reset and terminate all activities. This is
often referred to as a power on reset .Activating a power on reset will cause all
values the registers to be lost. It will set program counter to all 0s.In order for the
RESET input to be effective it must have a minimum duration of two machine
cycles. In other words the high pulse must be high for a minimum of two machine
cycles before it is allowed to go low.
Pin 10-17(Port 3) :- Similar to port 1, each of these pins can serve as general input
or output. Besides, all of them have alternative functions:
Pin 10(RXD) :- Serial asynchronous communication input or Serial synchronous
communication output.
Pin 11(TXD) :- Serial asynchronous communication output or Serial synchronous
communication clock output.
39
40
memory with capacity of 64Kb is not used, which means that not all eight port bits
are used for its addressing, the rest of them are not available as inputs/outputs.
Pin 29(PSEN) :- This is an output pin. PSEN stands for program store enable. If
external ROM is used for storing program then a logic zero (0) appears on it every
time the microcontroller reads a byte from memory.
Pin 30(ALE) :- ALE stands for address latch enable. It is an output pin and is
active high. When connecting an 8031 to external memory, port 0 provides both
address and data. In other words the 8031 multiplexes address and data through
port 0 to save pins. The ALE pin is used for de-multiplexing the address and data.
Prior to reading from external memory, the microcontroller puts the lower address
byte (A0-A7) on P0. In other words, this port is used for both data and address
transmission.
Pin 31(EA) :- EA which stands for external access is pin number 31 in the DIP
packages. It is an input pin and must be connected to either Vcc or GND. In other
words it cannot be unconnected. By applying logic zero to this pin, P2 and P3 are
used for data and address transmission with no regard to whether there is internal
memory or not. It means that even there is a program written to the
microcontroller, it will not be executed. Instead, the program
writtento external ROM will be executed. By applying logic one to the EA pin, the
microcontroller will use both memories, first internal then external (if exists).
Pin 32-39(Port 0) :- Similar to P2, if external memory is not used, these pins can
be used as general inputs/outputs. Otherwise, P0 is configured as address output
(A0-A7) when the ALE pin is driven high (1) or as data output (Data Bus) when
the ALE pin is driven low (0).
Pin 40(Vcc) :- +5V power supply.
2.5PORTS 0,1,2,3:
41
All the ports upon RESET are configured as input, since P0-P3 have value FFH on
them. The following is a summary of features of P0-P3.
PORT 0:
Port 0 is also designated as AD0-AD7 allowing it to be used for both address and
data. When connecting an 8051/31 to an external memory, port 0 provides both
address and data. The 8051 multiplexes address and data through port 0 to save
pins. ALE indicates if p0 has address A0-A7.in the 8051 based systems where there
is no external memory connection the pins of P0 must be connected externally to
10k-ohm pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1,
P2 and P3. Open drain is a term used for MOS chips in the same way that open
collector is used for TTL chips. In many systems using the 8751, 89c51 or
DS89c4*0 chips we normally connect P0 to pull up resistors.
PORT 1, PORT 2:
In 8051 based systems with no external memory connection both P1 and P2 are
used as simple I/O. however in 8031/51 based systems with external memory
connections P2 must be used along with P0 to provide the 16-bit address for the
external memory. P2 is also designated as A8-A15 indicating its dual function.
Since an 8031/51 is capable of accessing 64k bytes of external memory it needs a
path for the 16 bits of address. While P0 provides the lower 8 bits via A0-a7 it is
the job P2 to provide bits A8-A15 of the address. In other words when the 8031/51
is connected to external memory P2 is used for the upper 8 bits of the 16 bit
address and it cannot be used for I/O.
PORT 3:
Port 3 occupies a total of 8 pins 10 through 17. It can be used as input or output. P3
does not need any pull-up resistors the same as P1 and P2 did not. Although port 3
is configured as input port upon reset this is not the way it is most commonly used.
42
Port 3 has the additional function of providing some extremely important signals
such as interrupts.
P3 BitFunction
Pin
P3.0
RXD
10
P3.1
TXD
11
P3.2
INT0
12
P3.3
INT1
13
P3.4
T0
14
P3.5
T1
15
P3.6
WR
16
P3.7
RD
17
43
CHAPTER - 5
EMBEDDED C PROGRAMING
44
unsigned char
signed char
unsigned int
signed int
The character data type is the most natural choice AVR is an 8-bit
microcontroller
Unsigned char is an 8-bit data type in the range of 0 255 (00 FFH) One
of the most widely used data types for the AVR- Counter value - ASCII
characters
C compilers use the signed char as the default if we do not put the keyword
unsigned
45
The 8-bit I/O ports PORTB, PORTC, PORTD each uses 8 pins except
PORTC uses 7 pins.
All the ports upon RESET are configured as input, ready to be used as input
ports
DATA TYPES
Type
Minimal Range
char
-127 to 127
unsigned char
0 to 255
signed char
-127 to 127
int
16 or 32
-32767 to 32767
unsigned int
16 or 32
0 to 65535
signed int
16 or 32
Same as int
short int
16
-32767 to 32767
16
0 to 65535
16
long int
32
2,147,483,647
2,147,483,647
32
32
0 to 4,294,967,295
float
32
double
64
to
46
long double
80
47
statement;
Where a statement may consist of a single statement, a block of statements. The
else clause is optional.
Switch-case
C has a built-in multiple-branch selection statement, called switch, which
successively tests the value of an expression against a list of integer or character
constants.
switch (expression)
{
case constant1:
statement sequence
break;
.
default:
statement sequence }
The default statement is executed if no matches are found.
5.5 LOOPS
For loop
The general form of the for statement is
for(initialization; condition; updation)
Statement;
The for loop continues to execute as long as the condition is true. Once the
condition becomes false, program execution resumes on the Statement following
the for.
48
5.6 FUNCTIONS
Functions are the blocks in which we define the steps that how the program will
work. The general form of a function is:
Return -type function-name (parameter list)
{
body of the function
}
The return-type specifies the type of data that the function returns. The parameter
list is a comma-separated list of variable names.Need of Functions-Functions is
used so that we dont have to write the code repeatedly over and over again. If a
task is required to be done frequently then we can write this task code in a function
and call this function whenever needed.
49
50
CHAPTER - 5
Interfacing
51
52
53
common cathode (CC). In a CA display, the anodes for the seven segments and the
decimal point are joined into a single circuit node. To illuminate a segment in a CA
display, the voltage on a cathode must be at a suitably lower voltage (about .7V)
than the anode. In a CC display, the cathodes are joined together, and the segments
are illuminated by bringing the anode voltage higher than the cathode node (again,
by about .7V). The Dig labboard uses CA displays.
The seven LEDs in each digit are labeled a-g. Since
the Digilab board usesCA displays, the anodes for
each of the four digits are connected in a common
node, so that four separate anode circuit nodes exist
(one per digit).Similar cathode leads from each digit
have also been tied together to form seven common
circuit nodes, so that one node exists for each segment type. These four anode and
seven cathode circuit nodes are available at the J2connector pins labeled A1-A4
and CA-CG. With this scheme, any segment of any digit can be driven
individually. For example, to illuminate segments and c in the second digit, the b
and c cathode nodes would be brought to a suitable low voltage (by connecting the
corresponding circuit node available at the J2 connector to ground), and anode 2
would be brought to a suitablehigh voltage (by connecting the corresponding
circuit node available at theJ2 connector to Vdd).
/* PROGRAM TO SWITCH ON SEVEN SEGMENT DISPLAY MOVING FROM LSB TO
MSB */
#include<reg51.h>
void delay()
{
54
int a;
for(a=0;a<=30000;a++);
}
void main()
{
P2=0x3F;
delay();
P2=0x30;
delay();
P2=0x5B;
delay();
P2=0x1F;
delay();
P2=0x66;
delay();
P2=0x6D;
delay();
P2=0x7C;
delay();
P2=0x07;
delay();
P2=0x7F;
delay();
P2=0x3F;
delay();
}
55
56
Figure 5.1-stepper
motor
a. Input to SM is in the form of electric pulses whereas input to a CM is invariably
from a constant voltage source.
b. A CM has a free running shaft whereas shaft of SM moves through angular
steps.
6.3.1 Step Angle & Steps per Revolution
Movement associated with a single step, depends on the internal construction of
the motor, inParticular the number of teeth on the stator and the rotor. The step
angle is the minimum degree of rotation associated with a single step. Step per
revolution is the total number of steps needed to rotate one complete rotation or
360degrees (e.g., 180 steps * 2 degree = 360) Since the stepper motor is not
ordinary motor and has four separate coils, which have tobe energized one by one
in a stepwise fashion. We term them as coil A, B, C and D. At a particular instant
the coil A should get supply and then after some delay the coil B should get supply
and then coil C and then coil D and so on the cycle continues. The more the delay
is introduced between the energizing of the coils the lesser is the speed of the
stepper motor advice versa.
57
/* PROGRAM USING STEPPER MOTOR*/
#include<reg51.h>
void delay()
{
int a;
for(a=0;a<=6000;a++);
}
void main()
{
P2=0x00;
delay( );
P2=0xff;
delay();
P2=0x00;
delay( );
P2=0xff;
delay();
P2=0x00;
delay( );
P2=0xff;
delay( );
}
58
59
and contacts are released. Relays can generate a very high voltage across the coil
when switched off. This can damage other components in the circuit. To
preventthis diode is connected across the coil. Relay has five points. Out of the 2
operating points one is permanently connected to the ground and the other point is
connected to thecollector side of the power transistor. When Vreaches the collector
side i.e. signal is given to the operating points the coil gets magnetized and attracts
the iron armature. The iron plate moves from normally connected (NC) position to
normally open (NO) position. Thus the heater gets the phase signal and is ON. To
remove the base leakage voltage when no signal is present a 470-ohmresistance is
used.
/* PROGRAM USING RELAY */
#include<reg51.h>
void delay()
{
int a;
for(a=0;a<=6000;a++);
}
sbit relay=P1^1;
void main()
{
while(1)
{
relay =0;
delay();
delay();
60
delay();
delay();
delay();
relay=1;
delay();
delay();
delay();
delay();
delay();
}
}
61
CHAPTER - 7
CONCLUSION
62
CONCLUSION
The
are
of
prime
importance
for
electronic
control
and