Академический Документы
Профессиональный Документы
Культура Документы
Engineering
A
SUMMER TRAINING REPORT
ON
EMBEDDED SYSTEM
SUBMITTED TO: Mr. Vinod Kumar
SUBMITTED BY:Diksha,Sangam,Priyanka
ELECTRONICS
Electronics is the branch of science which deals with the
behavior of electron under the influence of electric and
magnetic field.
Started with development of telegraph in late 19th century.
Applications:
Radio
Television
RADAR
Computer
EMBEDDED SYSTEM
An embedded system is one that has a dedicated
purpose software embedded in a computer
hardware.
Single purpose
Larger in size
Smaller in size
Power consuming
Faster than pc
ELECTRONIC COMPONENTS
Resistor
Capacitor
Diode
Switches
LED
Seven segment display
LCD
Relay
RESISTOR
It is a electrical component that
limits the flow of electric current in
the circuit.
Tendency to oppose electric
current.
Resistor is a passive component
used to control current in a circuit.
The resistance is given by the ratio
of voltage applied across the
terminals to the current passing
through it.
CAPACITOR
Capacitor is a passive component used to
store charge.
The charge (q) stored in a capacitor is the
product of its capacitance (C) value and the
voltage (V) applied to it.
Q=C*V
It stores electric charge and then discharges
it into the circuit.
It blocks the direct current and allows the
alternating current to pass through it.
The unit of capacitance is FARAD.
A capacitor contains two conductor plates
which are generally made of metal and an
insulator between them.
DIODE
A diode is a unipolar device.
Diode is a rectifying device which conducts
only from anode to cathode.
Diode behaves open circuited for the current
flow from cathode to anode.
When forward biased there is a small amount
of voltage necessary to get the diode going.
When reverse biased an ideal diode will
block current.
If enough voltage (reverse) is applied, and
junction breaks down and lets current pass
through.
SWITCH
Used to make or break electronic circuit.
WORKING OF LED
DC Motor.
Stepper Motor.
Transistors.
Voltage Regulators.
H-Bridge
TRANSISTOR
VOLTAGE REGULATOR
A voltage regulator is a device that
maintains a relatively constant
output voltage even though its input
voltage may be highly variable.
The voltage regulator IC maintains
the output voltage at a constant
value.
The 78xx is voltage regulator IC
series.
The xx in 78xx indicates the fixed
output voltage it is designed to
provide.
MICROPROCESSOR
Microcomputer a computer with a microprocessor as its
CPU. Includes memory, I/O etc.
Microprocessor silicon chip which includes ALU,
register circuits & control circuits
Microcontroller silicon chip which includes
microprocessor, memory & I/O in a single package.
DEFINITIONS REGARDING
MICROPROCESSOR
Microprocessor: is a programmable device that takes in
numbers, performs on them arithmetic or logical operations
according to the program stored in memory and then
produces other numbers as a result
Instructions: Each microprocessor is designed to execute a
specific group of operations. This group of operations is
called an instruction set. This instruction set defines what the
microprocessor can and cannot do.
Data Bus
RAM
ROM
Address Bus
I/O
Port
Timer
Serial
COM
Port
A MICROPROCESSOR-BASED SYSTEM
ORGANIZATION OF SYSTEM
INTERNAL ARCHITECTURE
MICROCONTROLLER
A microcontroller is a small and low-cost computer
built for the purpose of dealing with specific tasks, such
as displaying information in a microwave LED or
receiving information from a televisions remote control.
Microcontrollers are mainly used in products that
require a degree of control to be exerted by the user.
Microcontroller is a device which integrates a number of
the components of a microprocessor system onto a single
microchip. So a microcontroller combines onto the same
microchip :
The CPU core
Memory (both ROM and RAM)
Some parallel digital I/O
Introduction to Microcontroller
8051
4K
128
2
32
1
6
8052
8K
256
3
32
1
8
8031
10K
128
2
32
1
6
Features of 8051
ROM
- 4K bytes
RAM
- 128 bytes
Timer
- 2
I/O pins
- 32
Serial port
- 1
Interrupt sources - 6
8051 is based on CISC architecture.
It is based on Harvard architecture. So, it has separate
program and data memory.
APPLICATIONS OF MICROCONTROLLERS
Mobile Phones
Auto Mobiles
Washing Machines
Cameras
Security Alarms
Microprocessor vs Micro-controllers
Microprocessors
High end of market where performance matters
High power dissipationhigh cost
Need peripheral devices to work
Diff programs multiple times
Microcontrollers
Targeted for low end of market where performance does not
matter
Low power dissipation low cost
Memory plus I/O devices, all integrated into one chip
Single program multiple times
BITS
In 8-bit microcontroller, the point when the internal bus is
8-bit . The examples of 8-bit microcontrollers are Intel
8031/8051, PIC1x and Motorola MC68HC11 families.
The 16-bit microcontroller performs greater precision and
performance as compared to 8-bit. Some examples of 16-bit
microcontroller are 16-bit MCUs are extended 8051XA,
PIC2x, Intel 8096 and Motorola MC68HC12 families.
The 32-bit microcontroller uses the 32-bit instructions to
perform the arithmetic and logic operations. These are used
in automatically controlled devices including engine control
systems, office machines, appliances . Some examples are
Intel/Atmel 251 family, PIC3x.
MEMORY DEVICES
Embedded memory microcontroller: When an embedded
system has a microcontroller unit that has all the
functional blocks available on a chip is called an
embedded microcontroller. For example, 8051 having
program & data memory, I/O ports, serial
communication, counters and timers and interrupts on the
chip is an embedded microcontroller.
External Memory Microcontroller: When an embedded
system has a microcontroller unit that has not all the
functional blocks available on a chip is called an external
memory microcontroller. For example, 8031 has no
program memory on the chip is an external memory
microcontroller.
INSTRUCTION SET
CISC: CISC is a Complex Instruction Set Computer. It
allows the programmer to use one instruction in place of
many simpler instructions.
RISC: The industry trend for microprocessor design is
for Reduced Instruction Set Computers (RISC) designs. It
allows each instruction to operate on any register or use
any addressing mode and simultaneous access of program
and data.
MEMORY ARCHITECTURE
Harvard Memory Architecture Microcontroller: The point
when a microcontroller unit has a dissimilar memory
address space for the program and data memory, the
microcontroller has Harvard memory architecture in the
processor.
Princeton Memory Architecture Microcontroller: The
point when a microcontroller has a common memory
address for the program memory and data memory, the
microcontroller has Princeton memory architecture in the
processor.
Embedded Systems
Embedded system means the processor is embedded into
that application.
An embedded product uses a microprocessor or
microcontroller to do one task only.
In an embedded system, there is only one application
software that is typically burned into ROM.
Example printer, keyboard, video game player
On-chip
ROM for
program
code
Timer/Counter
On-chip
RAM
Timer 1
Timer 0
CPU
OSC
Bus
Control
4 I/O Ports
P0 P1 P2 P3
Address/Data
Serial
Port
TxD RxD
Counter
Inputs
FEATURES OF 8051
1. 4 KB on chip program memory.
2. 128 bytes on chip data memory(RAM).
3. 4 register banks.
4. 128 user defined software flags.
5. 8-bit data bus
6. 16-bit address bus
7. 32 general purpose registers each of 8 bits
8. 16 bit timers (usually 2, but may have more, or less).
9. 3 internal and 2 external interrupts.
10. Bit as well as byte addressable RAM area of 16 bytes.
11. Four 8-bit ports, (short models have two 8-bit ports).
12. 16-bit program counter and data pointer.
13. 1 Microsecond instruction cycle with 12 MHz Crystal
Registers in 8051
In CPU, registers are used to store information
temporarily. That information could be a byte of data to be
processed, or an address pointing to the data to be fetched.
8051 have 8-bit registers
D7 D6 D5 D4 D3 D2 D1 D0
MSB
LSB
Flag Bit
8051 has a flag register to indicate arithmetic conditions such
as carry bit. The flag register of 8051 is called Program Status
Word (PSW) register.
PSW.7
PSW.6
PSW.5
PSW.4
PSW.3
PSW.2
PSW.1
PSW.0
Carry Flag
Auxiliary Carry Flag
Available to the user for general purpose
Register Bank selector bit 1
Register bank selector bit 0
Overflow flag
User-definable bit
Parity flag.(odd/even no of 1 bit in the accumulator)
RS1
0
0
1
1
RS0
0
1
0
1
Register bank
0
1
0
1
Address
00H-07H
08H-0FH
10H-17H
18H-1FH
CY flag:- This flag is set when there is a carry out from the D7
bit. This flag bit is affected after an 8-bit addition or
subtraction.
AC flag :- If there is a carry from D3 to D4 during ADD or
SUB operation, this bit is set; otherwise cleared.
P flag :- It reflects the number of 1s in the A (accumulator)
register only. If A register contains an odd number of 1s, then
P=1.If its even, then P=0.
OV Flag :- This is set whenever the result of a signed number
operation is too large, causing the high order bit to overflow
into sign bit.
Example:
1)38h+2Fh=67
0001 1100
+0010 1111
0110 0111
CY=0no carry beyond D7.
AC=1carry from D3 to D4.
P=1 since accumulator has an odd number of 1s.
Stack in 8051
It is a section of RAM.
Stack is used to store information temporarily.
The information could be data or address.
PIN DESCRIPTION
Pins 1-8: Port 1 Each of these pins can be configured as an input or an output.
Pin 9: RS A logic one on this pin disables the microcontroller and clears the contents of
most registers. In other words, the positive voltage on this pin resets the microcontroller.
By applying logic zero to this pin, the program starts execution from the beginning.
Pins10-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.
Pin 12: INT0 Interrupt 0 input.
Pin 13: INT1 Interrupt 1 input.
Pin 14: T0 Counter 0 clock input.
Pin 15: T1 Counter 1 clock input.
Pin 16: WR Write to external (additional) RAM.
Pin 17: RD Read from external RAM.
Pin 18, 19: X2, X1 Internal oscillator input and output. A quartz crystal which specifies
operating frequency is usually connected to these pins. Instead of it, miniature ceramics
resonators can also be used for frequency stability. Later versions of microcontrollers
operate at a frequency of 0 Hz up to over 50 Hz.
Program No:- 1
Aim:- Write a program to add two numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
printf("Enter the two numbers=");
scanf("%d%d",&a,&b);
c=a+b;
printf("Sum=%d",c);
getch();
}
Output:-
Program No:- 2
Aim:- Write a program to check whether the number is greater or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("Enter the two numbers=");
scanf("%d%d",&a,&b);
if(a>b)
printf("a is greater");
else
if (b>a)
printf("b is greater");
else
printf("both the numbers are same");
getch();
}
Output:-
Program No:- 3
Aim:- Write a program to swap the numbers with using 3rd variable.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("Enter the value of a,b");
scanf("%d%d",&a,&b);
c=a;
a=b;
b=c;
printf("%d,%d",a,b);
getch();
}
Output:-
Program No:- 4
Aim:- Write a program to swap the numbers without using 3rd variable.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
printf("Enter the two numbers=");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("%d,%d",a,b);
getch();
}
Output:-
Program No:- 5
Aim:- Write a program for doing simple calculations.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,s,d,m,di;
printf("Enter the two numbers=");
scanf("%d%d",&a,&b);
s=a+b;
d=a-b;
m=a*b;
di=a/b;
printf("Sum= %d, Difference =%d, Multiplication =%d, Division =%d",s,d,m,di);
getch();
}
Output:-
Program No:- 6
Aim:- Write a program to check the number is greater in 3 numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter the value of a,b,c=");
scanf("%d%d%d",&a,&b,&c);
if (a>b&&a>c)
printf("a is greater");
else if(b>c&&b>a)
printf("b is greater");
else if (c>a&&c>b)
printf("c is greater");
else
printf("a=b=c");
getch();
}
Output:-
Program No:- 7
Aim:- Write a program to separate the 2 numbers of 2 digit number.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter the value of a=");
scanf("%d",&a);
b=a%10;
printf("%d",b);
a=a/10;
printf("\n%d",a);
getch();
}
Output:-
Program No:- 8
Aim:- Write a program to reverse a number.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,i,s=0;
clrscr();
printf("enter the number=");
scanf("%d",&a);
while(a>0)
{
i=a%10;
s=s*10+i;
a=a/10;
}
printf("%d",s);
getch();
}
Output:-
Program No:- 9
Aim:- Write a program to which tells about the input age is of adult or minar.
#include<stdio.h>
#include<conio.h>
void main()
{
int age;
clrscr();
printf("enter the age");
scanf("%d",&age);
if(age>18)
printf("the person is adult");
else
printf("the person is minor");
getch();
}
Output:-
Program No:- 10
Aim:- Write a program to print the numbers from 0 to 99 using the loops.
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
clrscr();
for(i=0;i<=99;i++)
{
printf("%d",i);
}
getch();
}
Output:-
Program No:- 11
Aim:- Write a program to check whether the number is palindrome or not.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,p,q;
clrscr();
printf("enter the number=");
scanf("%d",&a);
{
p=a%100;
q=a/100;
b=p%10;
c=p/10;
p=b*10+c;
}
if(p==q)
printf("palindrome number");
else
printf("not");
getch();
}
Output:-
Program No:- 12
Aim:- Write a program to print the numbers from 100 to 1 using for loop.
#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=100;i>=1;i--)
{
printf("%d",i);
}
getch();
}
Output:-
Unsigned int
16bit datatype.
value in a range of 0-65535.
used to define 16-bit memory address.
8051 is 8-bit microcontroller, so int datatype take 2bytes of
RAM.
Signed int
16 bit datatype.
Uses MSB (D15 of D15-D0) to represent sign(-ve or +ve).
15 bit for magnitude.
Value range from -32768 to 32767.
Time Delay
There are two ways to create a time delay 8051:
1.Using a simple loop
2.Using the 8051 timers
8051 Timers
Both Timer 0 and Timer 1 are 16 bits wide. Since the
8051 has an 8-bit architecture, each 16-bit timer is accessed as
2 separate registers of low byte and high byte.
Timer 0 Register
The 16-bit registers of Timer 0 are accessed as low byte
and high byte. The low byte is called TL0 (Timer 0 low byte)
and the high byte register is called TH0 (Timer 0 high byte).
These registers can be accessed like any other register, such as
A,B,R0,R1, etc.
TH0
TL0
Timer 1 register
Timer 1 is also 16 bit register, and its 16-bit register is
split into two bytes, referred to as TL1(Timer 1 low byte) and
TH1 (Timer 1 high byte). These registers are accessible in the
same way as Timer 0.
TH1
D15 D14 D13 D12 D11 D10 D9
TH0
D8
D7
D6
D5
D4
D3
D2
D1
D0
Serial Transfer
Sender
Receiver
Sender
Receiver
D7
Simplex
Half Duplex
Full Duplex
Transmitter
Receiver
Transmitter
Receiver
Receiver
Transmitter
Transmitter
Receiver
Receiver
Transmitter
space
stop
bit
0
D7
1
D0
start
bit