0% found this document useful (0 votes)
188 views30 pages

MGTechSolution - 8051 User Manual - V2

Electronics

Uploaded by

12aabbaa30
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views30 pages

MGTechSolution - 8051 User Manual - V2

Electronics

Uploaded by

12aabbaa30
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

8051 Target Board User

Manual

Student Name: _____________________________________________________


Class: ______________________________________________ Batch: _______
Subject: __________________________________________________________

Mr. Girish Avhale (SET, NET) Dr. M. A. Shaikh (SET, Ph.D.)


Email ID: [email protected] Email ID: [email protected]
Mobile No.- 9822590931, 8237348429 Mobile No.- 9960277201, 9834975744
Steps for installation of Keil uVision 3
1. Double Click on c51v812.exe file of Keil uVision 3.
2. Click Next >>.

3. Agree the License agreement. Click Next >>.

4. Select Destination Folder. Click Next >>.


5. Enter your information. Click Next >>. Installation starts.

6. After completing installation. Click Finish. This finishes installation and shortcut is created on
the desktop.

----------------------------------------****************--------------------------------------------
Steps for use of Keil uVision 3 software
1. Double click on Keil uVision 3 icon on the desktop.
2. Close project if any open. Go to Project -> Close Project.
3. Go to Project -> New uVision Project. Create New project window will open.

4. Give project name and select destination folder for the project. Click on Save.
5. Select the device for target of your choice (Go to Data base -> Atmel -> Select AT89S52). Press
OK.

6. uVision3 window will appear. Click No.


7. The Project Workspace window will open. Then go to the File ->New. New Text file will open,
write your code there.

8. Save the File with .c extension if program is in C language (or with .asm extension if program
is in assembly language) in the same folder where project is created.

9. Go to Project Workspace window, right click on Source Group 1 and select Add files to Group
‘Source Group 1’.
10. Select .C File and press Add once then close.

11. Again Go to Project Workspace window, right click on Target 1, Select Options for Target
‘Target 1’.

12. In the Target Tab, Select Xtal frequency according to the need. Xtal = 12MHz.
13. Then select Output Tab, select the box of Create HEX file and press OK.

14. Again Go to Project Workspace window, right click on Target 1, Select Build Target.
15. The output window shows any errors and warnings.

16. If there are any errors, correct in the program save it and then build the project again.
17. After zero errors and zero warnings the .hex file is created. This .hex file can be loaded into
microcontroller’s ROM using Programmer later.
18. If anyone want to debug the program go to Debug -> Start/Stop Debug Session.

19. The Debug Session is start and Project Workspace window shows all CPU registers and their
contents. You can run the program continuously or stepwise, by the Run or Step button in the
Debug options (or on toolbar buttons) and observe the changes in the CPU registers.
20. One can also view the content of memory for that go to View -> Memory Window.

21. Also one can view the contents of parallel ports, serial port and Timers. Go to Peripherals and
select the desired peripheral you want to observe.

22. After completing the debug operation stop Debug Session. Go to Debug -> Start/Stop Debug
Session.
23. Then close the project. Go to Project -> Close Project.
------------------------------------------------------------*************----------------------------------------------------------
Steps to use WLPRO software
1. Run WLPRO.exe or double click on desktop icon to open the software. (This is Portable
Software you do not need to install).
2. At startup, if programmer is connected properly it shows following message. If programmer is
not connected it shows message “Failed to connect with programmer”.
3. If programmer is not connected, change the USB port and try again. If not connected check
USB drivers if not installed, install the USB driver.

4. Now Connect the “ISP PORT” connector to your desired Microcontroller board with 10 pin
FRC cable.
5. From Device Menu, Click on Select Device.
6. Then Select ATMEL option and then AT89S52@ISP device. Click on “Ok”.

7. Click on “Config” icon.


8. Select Mode 3 and click on OK.

9. Click on “Settings” icon.


10. Make the setting as shown in following figure. (Don’t Select ‘Protect’ option)

11. Click on “Load” icon and select the desired “.hex” file.
12. Then select options shown in following figure and press ok.

13. Then click on “Auto” icon to upload program into the IC.
14. The selected will be programmed successfully and following message will be displayed.

------------------------------------------------------------*************----------------------------------------------------------------
Experiment – 1
Title: Interfacing of thumbwheel & seven segment display to 8051 microcontroller
Aim: To study and understand Interfacing of thumbwheel & seven segment display to 8051
microcontroller.
Objectives:
 To understand the concept of thumbwheel switch interfacing.
 To study interfacing of thumbwheel switch to Arduino.
 To study Keil IDE software.
Software Used: Keil uVision IDE
Circuit Diagram:

Theory:
Thumbwheel Switch: Digital computers, microprocessors, and other digital systems are binary
operated. The data is processed in the form of ‘0’s and ‘1’s. However, we communicate in the form of
decimal numbers and alphabetic characters only. Therefore, the need arias for interfacing between
digital systems and human operators. To demonstrate this task, we would use Thumbwheel switch as
input device, and seven-segment display as output device. The process of converting familiar code to is
known as encoding. The reverse process of converting binary to familiar code known as decoding.

Numbers can be represented in large variety of codes. Computers and other digital circuits are
required to handle data, which may be numerics, alphabets or special characters are to be converted into
binary form. For convenience binary code is always grouped into three bit groups (octal code), four bit
group (BCD or Hexadecimal code). Unfortunately, different number systems are not much popular
except decimal number system. Decimal number is most popular today for setting time angle, counts in
digit system. Thumb wheel switch converts decimal number into BCD form, which could be further
processed by the systems and result is displayed once again in decimal form. We can provide decimal
number using thumb – wheel switch.

Procedure:
 Connect DC power adaptor to the MGTechSolution 8051 Target board.
 Start Keil IDE and follow the steps mention in the “Steps to use of Keil IDE software”.
 Compile the written program, if there are no errors connect the PC to the programmer placed on
the MGTechSolution 8051 Target board; by using USB cable.
 Follow the procedure mention in the “Steps to use of WLPRO software”. Upload the program.
 Connect the Thumbwheel switch and SSD as shown in the circuit diagram.
 Observe the output on SSD.
Program:
#include<reg51.h>
void delay();
char arr[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void main()
{
unsigned char count = 0;
P3=0X00;
P2=0X0F;
while(1)
{
count = P2;
count = count & 0X0F;
P3=arr[count];
delay();
delay();
}
}
void delay()
{
int i;
for(i=0;i<=30000;i++);
}

Applications of Thumbwheel Switch: (Student can search & write application here)

Result: Interfacing of Thumbwheel Switch with 8051 is successfully studied, tested and observe the
output.

Teacher’s Sign.

-----------------------------------------------------------*************----------------------------------------------------------
Experiment – 2
Title: Traffic light controller using 8051 microcontroller.
Aim: To study and understand Interfacing Traffic light controller to 8051.
Objectives:
 To understand the concept of Traffic light controller.
 To study interfacing of Traffic light controller to 8051.
 To study Keil uVision IDE software.
Software Used: Keil uVision IDE
Circuit Diagram:

Procedure:
 Connect DC power adaptor to the MGTechSolution 8051 Target board.
 Start Keil IDE and follow the steps mention in the “Steps to use of Keil IDE software”.
 Compile the written program, if there are no errors connect the PC to the programmer placed on
the MGTechSolution 8051 Target board; by using USB cable.
 Follow the procedure mention in the “Steps to use of WLPRO software”. Upload the program.
 Make necessary connections as shown in the circuit diagram.
 Observe the output.
Program:
#include<reg51.h>
sbit rn=P3^0;
sbit yn=P3^1;
sbit rs=P3^2;
sbit ys=P3^3;
sbit rw=P3^4;
sbit yw=P3^5;
sbit re=P3^6;
sbit ye=P3^7;
sbit gn=P2^0;
sbit gs=P2^1;
sbit gw=P2^2;
sbit ge=P2^3;

void delay()
{
long int i;
for(i=0;i<=50000;i++) ; //3 sec
}

void main()
{
while (1)
{
//north
rn=1;rs=0;rw=0; re=0;
gn=0;gs=1;gw=1;ge=1;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
//south
rn=0;rs=1;rw=0; re=0;
gn=1;gs=0;gw=1;ge=1;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
//west
rn=0;rs=0;rw=1; re=0;
gn=1;gs=1;gw=0;ge=1;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
//east
rn=0;rs=0;rw=0; re=1;
gn=1;gs=1;gw=1;ge=0;
yn=1;ys=1;yw=1;ye=1;
delay();delay();delay();delay();delay(); //15 sec
}
}

Applications of Traffic light controller: (Student can search & write application here)
Result: Interfacing of Traffic light controller with 8051 is successfully studied, tested and observe the
output.

Teacher’s Sign.

-----------------------------------------------------------*************----------------------------------------------------------
Experiment – 3
Title: Interfacing LCD to 8051Microcontroller.
Aim: To interface 16*2 LCD display to 8051 and display message on both lines of LCD.
Objectives:
 To study concept of LCD.
 To study 8051, keil µvision & ECE flash.
 To study LCD interfacing, flowcharts & programs using C.
Block Diagram:
+5V +5V

+5V

Reset 10uF 40 P1.0 D0


Vcc
R1

9 RESET
VEE POT

8.2K Vss
AT89S52
P1.7 D7 16*2 LCD
33pF
P3.0 RS
18
Y1 P3.1 EN
33pF

19 20
11.0592MHz RW A K

+5V

Theory:
LCD: A liquid crystal display (LCD) is a thin, flat electronic visual display that uses the light
modulating properties of liquid crystals (LCs). They are used in a wide range of applications including:
computer monitors, television, instrument panels, aircraft, cockpit display, signage, etc. It is an
electronically modulated device made up of any number of pixels filled with liquid crystals. LCD has
become very popular option for displaying in Embedded Applications. Since they are very cheap and
easy to interface with microcontrollers, they are widely found in devices like telephones, vending
machines, washing machines, toys etc. LCD comes in several varieties i.e. 16*2, 20*2, 20*4 etc. These
different LCD varieties can display different number of characters i.e. 16*2 can display 32 characters at
a time. The 16*2 model has 2 lines and 16 columns of display blocks. Each block can be used to display
1 character. So there are total 32 such blocks. One block has 8*5 pixels. Depending on which pixel is
ON and which is OFF we can display several Alpha-Numeric characters. LCD also has a backlight,
which helps us to see the display even in dark. In reality this module consists of a controller chip, a
segment driver chip, LCD display and some passive components. There are total 16 pins in the LCD
module. While using LCD, we can think a simple analogy for its operation. Each of the 32 blocks is a
memory, as soon as we write an ASCII number into one of these 32 memory locations the corresponding
character is displayed on that block. The function of displaying the character after decoding the data is
done by an onboard controller chip. The following table shows the LCD pin diagram, LCD commands.

Figure: LCD pin diagram

Figure: LCD commands

Procedure:
 Connect DC power adaptor to the MGTechSolution 8051 Target board.
 Start Keil IDE and follow the steps mention in the “Steps to use of Keil IDE software”.
 Compile the written program, if there are no errors connect the PC to the programmer placed on
the MGTechSolution 8051 Target board; by using USB cable.
 Follow the procedure mention in the “Steps to use of WLPRO software”. Upload the program.
 Make necessary connections as shown in the circuit diagram.
 Observe the output.
Program:
#include<reg51.h>
sbit RS=P3^0;
sbit EN=P3^1;
void LCDcmd()
{
RS=0;
EN=1;
EN=0;
}
void LCDdata()
{
RS=1;
EN=1;
EN=0;
}
void delay()
{
int i;
for(i=0;i<30000;i++);
}
void main()
{
P1=0x38;
LCDcmd();
delay();
P1=0x0E;
LCDcmd();
delay();
P1=0x06;
LCDcmd();
delay();
P1=0x01;
LCDcmd();
delay();
P1=0x80;
LCDcmd();
delay();

P1='W';
LCDdata();
delay();
P1='E';
LCDdata();
delay();
P1='L';
LCDdata();
delay();
P1='C';
LCDdata();
delay();
P1='O';
LCDdata();
delay();
P1='M';
LCDdata();
delay();
P1='E';
LCDdata();
delay();
while(1);
}
Result: Interfacing of 16*2 LCD with 8051 microcontroller is done successfully and message
displayed on both lines of LCD.

Teacher’s Sign.

----------------------------------------------------**********--------------------------------------------------
Experiment – 4
Title: Event counter using opto-coupler.
Aim: To study and understand Event counter using opto-coupler, seven segment display interface to
8051 Microcontroller.
Objectives:
 To understand the working principle of Event counter using opto-coupler.
 To study interfacing of Event counter using opto-coupler to 8051.
 To study Keil uVision IDE software.
Software Used: Keil uVision IDE
Circuit Diagram:

Theory:
An Opto Interrupter also known as photo interrupter is a transmission-type photo sensor that
integrates optical receiving and transmitting elements in a single package. This device will turn a circuit
on and off optically. It consists of a molded plastic housing with an IR LED facing a photo transistor
across a gap. Any object in the gap will interrupt the IR beam and consequently switch the photo
transistor on and off. The device is very fast and ideal for counting, timing or sensing. It is widely used
in Optical Switch, ATM Machines, Vending Machines, Edge and Position Detection, Office
Automation. The Opto switch or interrupter is a small U shaped black plastic package which has four
legs-2 for infra-red LED on one side of the U and 2 for light sensitive transistor on the other. Both are
inbuilt, no external connection is required. With both the infrared light source and the photo transistor
in a single package, the photo-interrupter employs transmissive technology to sense obstacles existence,
acts as on / off switchers or even to sense low resolution rotary or linear motions. i.e The principle states
that objects opaque to infrared will interrupt the transmission of light between an infrared emitting diode
and a photo sensor switching the output from an "ON" state to an "OFF" state.

Fig. Operation of Opto-interrupter

Procedure:
 Connect DC power adaptor to the MGTechSolution 8051 Target board.
 Start Keil IDE and follow the steps mention in the “Steps to use of Keil IDE software”.
 Compile the written program, if there are no errors connect the PC to the programmer placed on
the MGTechSolution 8051 Target board; by using USB cable.
 Follow the procedure mention in the “Steps to use of WLPRO software”. Upload the program.
 Make necessary connections as shown in the circuit diagram.
 Observe the output.

Program:
#include<reg51.h>
void delay();
sbit opto_sensor = P1^0;
char arr[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void main()
{
unsigned char count = 0;
P3=0X00;
opto_sensor = 1;
P3=arr[count];
while(1)
{
if(opto_sensor == 1)
{
count++;
if(count > 9)
{
count = 0;
}
P3=arr[count];
while(opto_sensor == 1);
}
}
}
void delay()
{
int i;
for(i=0;i<=30000;i++);
}

Applications of Opto interrupter: (Student can search & write application here)
Result: Interfacing of Opto interrupter with 8051 is successfully studied, tested and observe the output.

Teacher’s Sign.

-----------------------------------------------------------*************----------------------------------------------------------
Experiment – 5
Title: Speed Control of stepper motor using 8051 microcontroller.
Aim: To study and understand Speed Control of stepper motor using 8051 microcontroller.
Objectives:
 To understand the working principle of stepper motor.
 To study interfacing of stepper motor to 8051.
 To study Keil uVision IDE software.
Software Used: Keil uVision IDE
Circuit Diagram:

Theory:
A stepper motor is an electromechanical device which converts electrical pulses into discrete
mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when
electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct
relationships to these applied input pulses. The sequence of the applied pulses is directly related to the
direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the
frequency of the input pulses and the length of rotation is directly related to the number of input pulses
applied. For this practical stepper motor used is 28byj48. Stepping sequence is 1,2,4,8 for clockwise
direction and 8,4,2,1 for anti-clockwise direction.
Procedure:
 Connect DC power adaptor to the MGTechSolution 8051 Target board.
 Start Keil IDE and follow the steps mention in the “Steps to use of Keil IDE software”.
 Compile the written program, if there are no errors connect the PC to the programmer placed on
the MGTechSolution 8051 Target board; by using USB cable.
 Follow the procedure mention in the “Steps to use of WLPRO software”. Upload the program.
 Make necessary connections as shown in the circuit diagram.
 Observe the output.
Program:
#include<reg51.h>
void delay();
void main()
{
P1=0X00;
delay();
while(1)
{
P1=0X08;
delay();
P1=0X04;
delay();
P1=0X02;
delay();
P1=0X01;
delay();
}
}
void delay()
{
int i;
for(i=0;i<=3000;i++);
}
Applications of Stepper Motor: (Student can search & write application here)
Result: Interfacing of stepper motor with 8051 is successfully studied, tested and observe the output.
Teacher’s Sign.

-----------------------------------------------------------*************----------------------------------------------------------

You might also like