Beruflich Dokumente
Kultur Dokumente
Practical No .1
Aim: Study of the embedded system Components
Description : _______________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
Page 1
Page 2
Resistors
Page 3
Inductors
LEDs/Displays
Diodes
Page 4
Transistors
Sensors
Actuators
Page 5
Description : _______________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
Page 6
CAP
CRYSTAL
LED-BIBY
RESISTOR
Design:
Component values:
Crystal -> Frequency = 11.059mhz
Cap -> Capacitance = 33p
Resistor -> Resistance (ohm)=100
Code:
# include <regx51.h>
Void delay_ms(unsigned int k)
{
Unsigned int i,j;
for (i=0;i<k;i++)
{
for (j=0;j<110;j++)
{
}
Page 7
Page 8
Right click on the Source Group 1 and select Add Files to Group Source Group 1.
Page 9
Page 10
Go to Peripherals and select the Port 1 and press F5 to run the code.
Page 11
In the program file option, browse and add the hex file of the code. blinkingled.hex
PRACTICAL NO :3
Page 12
Description : _______________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
COMPONENTS:
Page 13
Page 14
CODE:
#include<REG51.H>
#include<stdio.h>
voidserial_init(void);
voidserial_init(void)
{
SCON=0x50;
TMOD=0x20;
TH1=0xFD;
TR1=1;
TI=1;
}
void main(void)
{
serial_init();
while(1)
{
printf("hello world!! \n\r");
}
}
OUTPUT:
Page 15
PRACTICAL NO :4
Page 16
Description : _______________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
COMPONENTS:
Page 17
CODE:
#include<reg51.h>
voidcct_init(void);
void delay(int);
voidlcdinit(void);
voidwritecmd(int);
Page 18
C1
C2
C3
C4
=
=
=
=
P1^4;
P1^5;
P1^6;
P1^7;
sbit E = P3^6;
sbit RS = P3^7;
int main(void)
{
char key;
cct_init();
lcdinit();
//RowA
//RowB
//RowC
//RowD
//Column1
//Column2
//Column3
//Column4
//E pin for LCD
//RS pin for LCD
while(1)
{
key = get_key();
// Get pressed key
writecmd(0x01);
// Clear screen
writedata(key);
// Echo the key pressed to LCD
}
}
voidcct_init(void)
{
P0 = 0x00;
P1 = 0xf0;
P2 = 0x00;
P3 = 0x00;
}
//not used
//used for generating outputs and taking inputs from Keypad
//used as data port for LCD
//used for RS and E
void delay(int a)
{
inti;
for(i=0;i<a;i++); //null statement
}
voidwritedata(char t)
{
RS = 1;
// This is data
P2 = t;
//Data transfer
Page 19
// => E = 1
// => E = 0
voidwritecmd(int z)
{
RS = 0;
// This is command
P2 = z;
//Data transfer
E = 1;
// => E = 1
delay(150);
E = 0;
// => E = 0
delay(150);
}
voidlcdinit(void)
{
delay(15000);
writecmd(0x30);
delay(4500);
writecmd(0x30);
delay(300);
writecmd(0x30);
delay(650);
writecmd(0x38);
writecmd(0x0c);
writecmd(0x01);
writecmd(0x06);
}
void Return(void)
{
writecmd(0x02);
delay(1500);
}
//function set
//display on,cursoroff,blink off
//clear display
//entry mode, set increment
//Return to 0 location on LCD
char READ_SWITCHES(void)
{
RowA = 0; RowB = 1; RowC = 1; RowD = 1;
if
if
if
if
(C1
(C2
(C3
(C4
==
==
==
==
0)
0)
0)
0)
{
{
{
{
delay(10000);
delay(10000);
delay(10000);
delay(10000);
while
while
while
while
(C1==0);
(C2==0);
(C3==0);
(C4==0);
//Test Row A
return
return
return
return
'A'; }
'B'; }
'C'; }
'0'; }
//Test Row B
Page 20
//Test Row C
if
if
if
if
return
return
return
return
(C1
(C2
(C3
(C4
==
==
==
==
0)
0)
0)
0)
{
{
{
{
delay(10000);
delay(10000);
delay(10000);
delay(10000);
while
while
while
while
(C1==0);
(C2==0);
(C3==0);
(C4==0);
'G'; }
'H'; }
'I'; }
'2'; }
//Test Row D
if
if
if
if
return
return
return
return
(C1
(C2
(C3
(C4
==
==
==
==
return 'n';
0)
0)
0)
0)
{
{
{
{
delay(10000);
delay(10000);
delay(10000);
delay(10000);
while
while
while
while
(C1==0);
(C2==0);
(C3==0);
(C4==0);
'J'; }
'K'; }
'3'; }
'4'; }
}
charget_key(void)
//get key from user
{
char key = 'n';
//assume no key pressed
while(key=='n')
//wait untill a key is pressed
key = READ_SWITCHES(); //scan the keys again and again
return key;
//when key pressed then return its value
}
Output:
Page 21
PRACTICAL NO :5
Aim :WAP to implement ADC0808 with 8051 microcontroller
Page 22
Components:
ADC0808
AT89C51:11.059MHz
Page 23
CAP
C1:33pf
C2:33pf
C3:1uf
CAP-ELEC
CRYSTAL
LM016L
POT-HG
RES
Output:
Page 24
PRACTICAL NO :6 A
Aim :Write a program to interface stepper motor (Full Wave Stepper Motor)
Page 25
Page 26
Crystal
Resistor
ULN2003A
Stepper Motor 3 pins
Ground
Power
Design :
Components Value :
AT89C51 11.059 MHz
C1 & C2 33pF
C3 1uF
Crystal 11.059 MHz
R1 10k
Code :
Page 27
Output:
Page 28
Page 29
Description : _______________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
Page 30
Components Value :
AT89C51 11.059 MHz
C1 & C2 33pF
C3 1uF
Crystal 11.059 MHz
R1 10k
Code :
Page 31
Page 32
Page 33
Description : _______________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
Page 34
Components Value :
AT89C51 11.059 MHz
C1 & C2 33pF
C3 1uF
Crystal 11.059 MHz
R1 10k
R2 R17 100
Page 35
LED 10mA
Code :
#include<reg52.h>
void count1();
void delay();
unsigned int s,k;
sbit NR = P0^0;
sbit NY = P0^1;
sbit NG = P0^2;
sbit NL = P0^3;
sbit SR = P0^4;
sbit SY = P0^5;
sbit SG = P0^6;
sbit SL = P0^7;
sbit ER = P1^0;
sbit EY = P1^1;
sbit EG = P1^2;
sbit EL = P1^3;
sbit WRR = P1^4;
sbit WY = P1^5;
sbit WG = P1^6;
sbit WL = P1^7;
void main()
{
while(1)
{
NR =1;
NY=1;
NG=0;
NL=1;
SR=1;
SY=1;
SG=0;
SL=1;
WRR = 0;
WY=1;
Page 36
Page 37
Page 38
Page 39
PRACTICAL NO :8
Aim : Write a program to simulate elevator function
Description : _______________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
__________________________________________________________________
Page 40
Code:
#include<reg51.h>
void delayd();
char key; // key char for keeping record of pressed key
//2. PUSH BUTTON SWITCHES TO CALL LIFT
sbit TF = P1^0;
sbit SF = P1^1;
sbit FF = P1^2;
sbit GF = P1^3;
sbit led = P1^4;
char READ_SWITCHES(void);
Page 41
Page 42
Page 43
Page 44
Output:
Page 45
Page 46