You are on page 1of 25

8051Microcontroller

Students Project
Board
ADVANCE TECHNOLOGY
S.C.O. 160 1st Floor Sec 24D
CHANDIGARH
Ph. No. 0172-5086213
Email ID: atechindia@gmail.com

1
INDEX
S.No Topics Page. No
1. Introduction…………………………………. 03

2. Microcontroller Board sections…………. 08

2.1 P89C51RD2/AT89s51
2.2 RTC & E2PROM
2.3 LCD 16x2
2.4 Relays 6V DC
2.5 2 Seven Segment
2.6 8 Output Leds
2.7 RS 232 Connector
2.8 Dip Switches
2.9 Power Supply 5V

3. How to use FLASH MAGIC………………… 19

4. Experiments ………………………………. 22

2
FOREWORD

With changing times micro-controller has evolved and today is part of


almost every application viz. consumer electronics, communication systems
automotive medical etc. With various controller architectures and easy to use
compilers it has become easy to use a controller in wide range of
applications with ease. There are many micro controllers available in market
89C51(ATMEL, PHILPS) PIC(MICROCHIP) etc.

With change in technology trends and introduction of latest protocols


(CAN, MODBUS, I2C, SPI, USB) it is important to learn basics of micro
controller with interfacing devices like SRAM, E2PROM, Stepper Motor,
DC Motor, RTC, ADC, DAC, Relays, Displays. Keeping trends in mind
Advance Technology has designed “Micro Controller 8051 Students
Project Board”.

Since the Time to Market is crucial MAB can reduce the development time
since testing of basic devices can be done and by the time PCBs are
manufactured designer is ready with the tested code.

3
INTRODUCTION
AT-51 has on board
P89C51RD2/AT89s51
RTC &E2PROM
LCD 16x2
Relays 6V DC
2 seven segment
8 ouput leds
Dip switches
Power Supply 5V
RS-232 (FOR SERIAL INTERFACE)

CENTRAL PROCESSOR

Micro controller: - P89C51RD2/89S51 with four I/O ports


Crystal frequency: - 11.0592MHz
Internal Memory: - 64K/4K

MEMORY

4K memory which can be upgradeable to 516k is provided in EEPROM


section.

POWER SUPPLY REQUIREMENTS

Voltage Current
+ 5 V dc 1A

4
HARDWARE DIAGRAM

LCD
LED O/P

Programming
Seven Connector
Segmen
t

Relay 8051 UC

RTC

Eprom

RS 232

SELECTOR Digital IN.


SWITCH

5
BLOCK DIAGRAM OF 8051 STUDENT PROJECT BOARD

PROG
LCD SECTION CONN
SEVEN
SEGMENT
P0
BLUE
TOOT
H
UC BL
P1
UE
RTC & EPROM TO
RELAY AND SECTI
8051 OT
BUZZER ON
BL
H
SECTION P2
UE
TO
OT
SE
H
CT
POWER
SECTION SELECTOR BL
IO
RS
SWITCH DIGITAL IN UE
N
232
TO
SE
OT
CT
H
IO
N

SE
CT
IO
N

6
CONFIGURATION AND INSTALLATION

This harware board is standard manufacturer board with predefined setting


, which have restrictions to obey these seetings.

STEP WISE HARDWARE SETTINGS

1. Put all jumpers near PROG CONN on right corner on hardware board
2. Shift all left side if using Philips 89c51rd2bn.
3. Shift all right side if using atmel AT89S51.
4. Connect 5V power source to hardware board.
5. connect programming adaptor connector to PROG CONN. On
harware board just to right corner to program microcontroller through
FLASH MAGIC.
6. switch ON 1,2,3,4,5,6,7,8 switches of DIP switch (selector switch), to
see output

(I) on lcd “8051 microcontroller student project board.


(II) on seven segment “8051”.
(III) on LED “8051”.
(IV) on DIP/DIGITAL INPUT “8051”.
(V) on RELAY BUZZER “8051”.
(VI) On 6&7 switch for serial communication
(VII) 8 no. switch is not communicate

LCD
7-SEGMENT

LED
DIGITAL
INPUT

RELAY&
BUZZER

SERIAL
COMMU.

7
Connections for Experiments
LCD
 Data P1
 RS P3.6
 E P3.7

7-segment
 Control Port P3
 Data port P0

LEDs

 Port P0

Relay
 Relay1 port P0.1
 Buzzer port P0.0

RTC and EEPROM


 Port 3.4 data
 Port 3.5 clock

DIP SWITCH (digital input)


Port P2

RS 232(serial comm.)

 RX Port P3.2
 TX Port P3.1

8
HOW TO PROGRAM THE MICRO CONTROLLER ON
THE KIT

(1) Make the required code using KEIL compiler.

(2) Make the HEX file from the code file.

(3) Open FLASH MAGIC.

a) Browse for the location of file.

b) Click START.

c) Wait for the message

“FINISHED”

d) Select dip switch setting as mentioned above to see outputs.

9
Microcontroller 8051 Project Board Components
P89C51RD2
Features
• On-chip Flash Program Memory with In-System Programming
(ISP) and In-Application Programming (IAP) capability
• Boot ROM contains low-level Flash programming routines for
downloading via the UART
• Can be programmed by the end-user application (IAP)
• Parallel programming with 87C51 compatible hardware interface
to programmer
• Supports 6-clock/12-clock mode via parallel programmer (default
clock mode after Chip Erase is 12-clock)
• 6-clock/12-clock mode Flash bit erasable and programmable via
ISP
• 6-clock/12-clock mode programmable “on-the-fly” by SFR bit
• Peripherals (PCA, timers, UART) may use either 6-clock or
12-clock mode while the CPU is in 6-clock mode
• Speed up to 20 MHz with 6-clock cycles per machine cycle
(40 MHz equivalent performance); up to 33 MHz with 12 clocks
per machine cycle
• Fully static operation
• RAM expandable externally to 64 Kbytes
• Four interrupt priority levels
• Seven interrupt sources
• Four 8-bit I/O ports
• Full-duplex enhanced UART
– Framing error detection
– Automatic address recognition
• Power control modes
– Clock can be stopped and resumed
– Idle mode
– Power down mode
• Programmable clock-out pin
• Second DPTR register• Asynchronous port reset
• Low EMI (inhibit ALE)
• Programmable Counter Array (PCA)
– PWM
– Capture/compare

10
USE OF COMPILER AND PROGRAMMER

Compiler: KEIL

Programming Tool: FLASH MAGIC

1. Double Click on the icon present on the desktop.

2. The following window will be popped-up

11
3. Go to the project & click on new project

4. Make a folder on desktop & give file name.

12
5. when you click on the save button ,following window opens

13
6. Select Philips & 89c51RD2xx

7. Then select NO on the pop-up given below.

14
1) Then make a New File.

9. Write or copy your gsm code there & save it with extension .c or .asm
depending on your coding.

15
2) Go to target & then source group, right click on there & click on the
option add files to the project.

Select your asm or c file which you want to add.

16
3) Go to the option for target, click on output &tick on create hex file
option

4) Now build target.(Click on the pointed option)...

17
5) It will show you 0 errors &0 warning on Output Window.

↑↑

After performing all these steps the chip will be configured through Flash
Magic .Let us hand on the steps of chip configuration through Flash
Magic………

Special Notes: -

 Make all the DIP switches in off position before burning the program
in the controller.
 Connect the Programming Cable on your Kit (prog. Conn.)and other
side of cable with the COM Port of the Computer.
 Burn the Program in the microcontroller with help of Flash Magic as
explained in the next section.

18
How to use FLASH-MAGIC

1. Double Click on the icon present on the desktop.

2. The following window will be popped-up

Press cancel to continue.

3. Configuration
Click options and then click Advanced options…

19
now set the parameters as shown below

20
4. After selection of the chip (P89C51RDHxx) , Port (Com1),
Osc.Mhz(11.0592) we can see the window as below:

Select the blocks to erase, browse for the hex file to be loaded. Press
Start

5. Within 5-6 seconds the message will be displayed


“FINISHED”.

21
Experiment
/* This program displays data on LCD, 7-seg and switches the relays on/off
simultaneously
LCD is working in 4-bit mode. LCD data is sent through P1.0 to P1.3 pins.
The control of 7-seg
is on P0.0 to P0.3 and data is sent through P2*/

#include <REG51F.H>

sbit e = P1^4; // enable of LCD


sbit rs = P1^5; // rs of LCD
sbit relay1= P0^4;
sbit relay2= P0^5;

unsigned char a[]={"8051 Controller Student Project Board


"},i,j,x,y,e1,z1;
unsigned char command[7]={0x02,0x28,0x0C,0x01,0x06,0x80};
char arr[10]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xe7};

void delay()
{
int j1;
for(j1=0;j1<=1000;j1++);
}

void delay1()
{
int j1;
for(j1=0;j1<=100;j1++);
}

void longdelay()
{
int i1,k;
// for(i1=0;i1<=10;i1++)

22
for(k=0;k<=50;k++);
}

void verylongdelay()
{
int m1,m2;
for(m1=0;m1<=1000;m1++)
for(m2;m2<=100;m2++);

void lcd_inst(unsigned char command)


{
rs = 0; /*
Clear bit P0.5 */
P1 = (P1 & 0xF0)|((command>>4) & 0x0F);
e = 1;
/* Clear bit P0.4 */
delay1();
e = 0;
P1 = (P1 & 0xF0)|(command & 0x0F);
e = 1;
/* Clear bit P0.4 */
delay1();
e = 0;
delay1();
}

void lcd_data(unsigned char ldata)


{
rs = 1; /* Set
bit P2.5 */
P1 = (P1 & 0xF0)|((ldata>>4) & 0x0F);
e = 1;
/* Clear bit P0.4 */
delay1();
e = 0;
P1 = (P1 & 0xF0)|(ldata & 0x0F );
e = 1;
/* Clear bit P0.4 */

23
delay1();
e = 0;
delay1();
}
void timer1() interrupt 3
{

TR1=0;
for(e1=0;e1<=100;e1++)
{
P0=0x01;
P2=0xff;
delay();
P0=0x02;
P2=0xbf;
delay();
P0=0x04;
P2=0xed;
delay();
P0=0x08;
P2=0x86;
delay();

}
P0=0x00;
relay1=1;
verylongdelay();
verylongdelay();
relay1=0;
verylongdelay();
verylongdelay();
relay2=1;
verylongdelay();
verylongdelay();
relay2=0;
verylongdelay();
verylongdelay();
TL1=0x00;
TH1=0x00;
TR1=1;

24
}

/*void timer1() interrupt 3


{

} */

void main()
{
relay1=0;
relay2=0;
while(1)
{
TMOD=0x10;
for(z1=0;z1<=10;z1++)
{
TL1=0x00;
TH1=0x00;
IE=0x88;
TR1=1;
}
for(j=0;j<=5;j++)
{
lcd_inst(command[j]);
delay1();
}
for(i=0;i<=39;i++)
{
lcd_data(a[i]);
delay1();
}
for(x=1;x<=39;x++)
{
lcd_inst(0x18);
delay1();
}
}
}

25

You might also like