Embedded System
Embedded System
3 Interface 8051 with D/A converter and generate square wave of given 16 to 25
frequency on oscilloscope.
4 Interface 8051 with D/A converter and generate triangular wave of given 26 to 35
frequency on oscilloscope.
5 Using D/A converter generate sine wave on oscilloscope with the help of 36 to 45
lookup table stored in data area of 8051.
Practical No. :- 01
1
a. Design
b. Programming
c. Execution
d. Debugging
Software Requirement :-
• Proteus CAD Design Suit
• Code Vision
• Keil u4
A. Design :-
Proteus CAD Design suit software is use to design the diagrams of embedded circuits .
We can easily install proteus suit but take care that ISIS design should be work properly.
2
B. Programming
Once Design part is complete , Programming is the 2nd stage to perform the embedded
system practical‘s. To perform programming two types of tools are used as follow….
1. Code Vision
Code Vision is IDE which is provide environment to write ― C ‖ Programs for embedded
system development.
3
Using following Flow we can create new project in Code Vision____
Now we will get Project with System Generated code . And with Respective Changes we
can write a program.
There is one option ―Project‖ Select that option and compile and run the program then we
will get .hex file to execute the program.
C. Execution
For the execution purpose we have to use both software‘s ( proteus and keil or proteus and Code
vision ).
Once file is created using keil or Code vision we have to build and run that files .
Now right click on microcontroller and select edit properties and add hex. File to simulate the
project.
Add ― Hex ― or ― C‖ File ( Which is created using keil or code vision ) from system and then
we can simulate the project to perform operations.
4
D. Debugging
Debugging is the tool which is use to find out errors from program. But there is no option in
proteus to debug the program but at the running time if there is having problem with C program
then it will shows the errors with red notation that are noting but debugging done by the proteus.
In keil and code vision there is particular options to debugging and run the program.
5
So using these options we can debug , build , and run the embedded program.
6
Practical No :- 02
Aim :- Configure timer control registers of 8051 and develop a program to
generate given time delay.
Software Requirement :-
• Proteus CAD Design Suit
• Code Vision
Diagram :-
GROUND
7
Coading :-
#include<90s8535.h>
#include<delay.h>
void main(void) {
DDRA=0xff;
PORTA=0xff;
DDRB=0xff;
PORTB=0x00;
#asm("sei");
while(1) {
delay_ms(1000);
PORTA=PORTA^PORTB;
delay_ms(1000);
PORTB=PORTB^PORTA;
};
}
Step 2 :- Now click on save button and save the project with ―project‖ name and click on save
button.
8
Step 3 :-Now click on ―P‖ and select / search components that are required.
Step 4 :-Select all components like this and make a design for this practical and save the project.
9
Step 5 :-Now open code vision software to write ―C‖ program.
Step 6 :- Now click on file—new—project—and select AT90 projects— select controller type
from list—and select program—generate , save and exit.
10
Step 7 :- Now it will ask to save the ― C ― file save the c file with different 3 formats (we have
to save code vision c file in 3 different formats (c file , prj file and cwp file ) )
Step 8 :- Now write a program in given interface and save the file. But before saving and go for
execution compile and build the file using ―project‖ option . If there is zero error and zero
warning then proceed for finel execution.
Step 9 :- Now again open proteus project , Rignt click on controller and select ―edit properties‖
11
Step 10 :-There is one option ― program file ― . we have to select program file which is already
created using code vision software
Step 11 :-Now browse program file here ― timedelay.cof ‖ and click on ok.
12
And click on ― Run ― button to simulate the circuit with Program.
13
Output :-
14
Practical No:- 03
Aim :- Interface 8051 with D/A converter and generate square wave of given
frequency on oscilloscope.
Software Requirement :-
Keil u4
Coding :-
#include<reg51.h>
void delay(); void
main () { while(1)
{ P1=0xFF;
delay();
P1=0x00;
delay();
}}
void delay()
{ unsigned int i,j,k;
for(i=0;i<10;i++)
for(j=0;j<200;j++)
for(k=0;k<300;k++);
}
Steps to Perform :-
Step 1 :- Start Keil u4 software to perform this practical .and select project tab to create new
project.
15
Step 2 :- Now click on new project—give project name—and click on save button.
Once we click on save button it will Ask to select controller type with different
controllers names window.
16
Step 3 :- N ow select Atmel and then ― AT89C51 ‖ microcontroller
17
Step 4 :-Now click on ―new file‖
Step 5 :-Now click on ―save‖ button to save the C file. But remember that
File name should be put in double quotation mark ( eg. ―abc‖ ) , and extention should be capital
― C ― ( eg. ― abc.C ‖ ) and click on save button.
18
Step 7 :-Once writing of program is finished Right click on ―source group 1‘ and select ―add
files to group‖ . select required file –and click on Add.
19
Step 8 :-Now click on build or press F7 to build program.
20
And click on ok.
21
Now click on ―setup ― and set Variable as ― P1‖ because P1 is already use in Program. And
click on close.
22
Now click on Run or F5 button to run the program.
23
Output :-
Practical No:- 04
Aim :- Interface 8051 with D/A converter and generate triangular wave of
given frequency on oscilloscope.
Software Requirement :-
24
Keil u4
Coding :-
#include<reg51.h>
void main()
{
P1=0x00;
while (1)
{
do {
P1 +=0x05;
}
while(P1 < 0xFF);
do
{
P1 -= 0X05;
}
while (P1 > 0x00);
}
}
Step to Perform :-
Step 1 :- Start Keil u4 software to perform this practical .and select project tab to create new
project.
25
Step 2 :- Now click on new project—give project name—and click on save button.
Once we click on save button it will ask to select controller type with different
controllers names window.
26
Step 3 :- now select Atmel and then ― AT89C51 ‖ microcontroller
27
Step 5 :-Now click on ―save‖ button to save the C file. But remember that
File name should be put in double quotation mark ( eg. ―abc‖ ) , and extention should be capital
― C ― ( eg. ― abc.C ‖ ) and click on save button.
28
Step 7 :-Once writing of program is finished Right click on ―source group 1‘ and select ―add
files to group‖ and select required file –click on Add.
29
Step 8 :-now click on build or press F7 to build program.
30
And click on ok.
31
Now click on ―setup ― and set Variable as ― P1‖ because P1 is already use in Program. And
click on close.
32
Now click on Run or F5 button to run the program.
33
Output :-
34
Practical No:- 05
Aim :- Using D/A converter generate sine wave on oscilloscope with the help of lookup
table stored in data area of 8051.
Software Requirement :-
Keil u4
Coding :-
#include<reg51.h>
#include<intrins.h>
void main ()
{ unsigned
i;
unsigned int WAVEVALUE[16]=
{
128,192,224,240,255,
240,224,192,128,
64,32,16,0,
16,32,64
};
while(1)
{
for(i=0;i<16;i++)
P1=WAVEVALUE[i];
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}
}
Step to Perform :-
Step 1 :- Start Keil u4 software to perform this practical .and select project tab to create new
project.
35
Step 2 :- Now click on new project—give project name—and click on save button.
Once we click on save button it will ask to select controller type with different
controllers names window.
36
Step 3 :- N ow select Atmel and then ― AT89C51 ‖ microcontroller
37
Step 5 :-Now click on ―save‖ button to save the C file. But remember that
File name should be put in double quotation mark ( eg. ―abc‖ ) , and extention should be capital
― C ― ( eg. ― abc.C ‖ ) and click on save button.
38
Step 7 :-Once writing of program is finished Right click on ―source group 1‘ and select ―add
files to group‖ and select required file –click on Add.
39
Step 8 :-Now click on build or press F7 to build program.
40
And click on ok.
41
Now click on ―setup ― and set Variable as ― P1‖ because P1 is already use in Program. And
click on close.
42
Now click on Run or F5 button to run the program.
43
Output :-
44