8051 kit manual

18
Operational Manual for 8051 Development Kit 8051DK-6x10 For Workshop on “Embedded Systems using 8051 MuC” By: Anish Goel M.S.E.E., NJIT, USA

Upload: anishgoel

Post on 19-Jun-2015

1.176 views

Category:

Education


2 download

TRANSCRIPT

Page 1: 8051 kit manual

Operational Manual

for

8051 Development Kit

8051DK-6x10

For Workshop on

“Embedded Systems using 8051 MuC”

By: Anish Goel

M.S.E.E., NJIT, USA

Page 2: 8051 kit manual

8051DK-6x10 Manual Page 2

CONTENTS 1. List of contents of the package. 2. Details of the development kit and features. 3. Software installation steps. 4. Connecting and powering up the kit. 5. Tutorial on RIDE and Flash Magic. 6. Sample codes and their explanation.

Page 3: 8051 kit manual

8051DK-6x10 Manual Page 3

Chapter 1

List of contents of the package

The package contains:

1. A 6cm x 10cm 8051 Development kit PCB with following devices on it: a. P89V51RD2BN microcontroller chip. b. MAX232 chip c. 3mm LED’s – 4 Nos. d. Pushbutton Switches – 4Nos. e. Seven Segment Display (Common Cathode) – 1Nos. f. 0.5 cm DC motor with driver circuit. g. Serial DB-9 Connector. h. B-type USB connector. i. 11.0592 MHz crystal and other discrete components.

2. A USB cable, A to B type.

3. A serial Cable.

4. A CD containing the required software’s and this instruction manual.

Page 4: 8051 kit manual

8051DK-6x10 Manual Page 4

1 1

Chapter 2

Details of the development kit and Features

Identification

1 ------------------------------------------------------ Reset Switch 2 ------------------------------------------------------ Seven Segment Display 3 ------------------------------------------------------ FRC Male Connector 4 ------------------------------------------------------ Input Switch Array

2

1

3

4

5

6

7

9

10

11

12

13

14

15

8

Page 5: 8051 kit manual

8051DK-6x10 Manual Page 5

5 ----------------------------------------------------- Power ON/OFF Switch 6 ----------------------------------------------------- USB Female Connector B type 7 ----------------------------------------------------- USB cable 8 ----------------------------------------------------- LED’s for output 9 ----------------------------------------------------- Power ON LED 10 ----------------------------------------------------- Driver Circuit for DC motor 11 ----------------------------------------------------- D.C. Motor 12 ----------------------------------------------------- MAX-232 and capacitors 13 ----------------------------------------------------- Serial port DB-9 Female Con. 14 ----------------------------------------------------- Serial Cable 15 ----------------------------------------------------- Microcontroller P89V51RD2

Features:

1. The size of the kit is very small, due to which it is extremely handy and can be easily used without proper lab setup with a laptop machine.

Size in cm: 6 x 10

2. CPU of the development kit P89V51RD2BN which is a In-system programmable microcontroller with intel 8051 architecture.

3. For basic input/output interface LED’s and switches are provided. 4. A common cathode seven segment is interfaced to study interface of

display device. 5. A small DC motor (cell phone vibration motor) is interfaced to

microcontroller and the driver circuit is provided on the kit. 6. A MAX-232 IC with capacitors is interfaced to the microcontroller at its SCI

port to provide serial communication. 7. Power-ON reset circuitry is provided on the board that resets the

microcontroller when it is powered up. A reset switch is also present to reset the microcontroller at any instance.

8. USB cable is provided to power up the kit. A ON/OFF switch is present to turn the kit ON/OFF without disconnecting the cable. Power-ON indicator LED indicates if the kit is getting power.

Page 6: 8051 kit manual

8051DK-6x10 Manual Page 6

9. A 11.0592 MHz crystal is present on the board to provide clock to the chip. 10. Male FRC connector pins are available on both sides of the 8051 MuC chip

and are accessible to the user to interface any other device besides the interfaces provided ON-Board. These pins are connected to each pin on 8051 MuC.

Pin connections for MuC on the Kit.

Pin Number Function Connected to: Comments 1 Port 1 0th Bit (P1.0) LED1 and FRC pin -- 2 Port 1 1st Bit (P1.1) LED2 and FRC pin -- 3 Port 1 2nd Bit (P1.2) LED3 and FRC pin -- 4 Port 1 3rd Bit (P1.3) LED4 and FRC pin -- 5 Port 1 4th Bit (P1.4) FRC pin -- 6 Port 1 5th Bit (P1.5) FRC pin -- 7 Port 1 6th Bit (P1.6) FRC pin -- 8 Port 1 7th Bit (P1.7) Motor Driver and

FRC pin --

9 Reset Reset Switch and FRC pin

--

10 Port 3 0th Bit (P3.0 ) Max-232 and FRC pin

--

11 Port 3 1st Bit (P3.1) Max-232 and FRC pin

--

12 Port 3 2nd Bit (P3.2) FRC pin -- 13 Port 3 3rd Bit (P3.3) FRC pin -- 14 Port 3 4th Bit (P3.4) FRC pin -- 15 Port 3 5th Bit (P3.5) FRC pin -- 16 Port 3 6th Bit (P3.6) FRC pin -- 17 Port 3 7th Bit (P3.7) FRC pin -- 18 Crystal 1 (X1) Crystal and FRC pin -- 19 Crystal 2 (X2) Crystal and FRC pin -- 20 Ground GND and FRC pin -- 21 Port 2 0th Bit (P2.0 ) SW4 and FRC pin -- 22 Port 2 1st Bit (P2.1) SW3 and FRC pin -- 23 Port 2 2nd Bit (P2.2) SW2 and FRC pin -- 24 Port 2 3rd Bit (P2.3) SW1 and FRC pin -- 25 Port 2 4th Bit (P2.4) FRC pin -- 26 Port 2 5th Bit (P2.5) FRC pin --

Page 7: 8051 kit manual

8051DK-6x10 Manual Page 7

27 Port 2 6th Bit (P2.6) FRC pin -- 28 Port 2 7th Bit (P2.7) FRC pin -- 29 ALE GND and FRC pin -- 30 PSEN VCC and FRC pin -- 31 EA/Vpp VCC and FRC pin -- 32 Port 0 0th Bit (P0.7 ) SSD and FRC pin -- 33 Port 0 1st Bit (P0.6) SSD and FRC pin -- 34 Port 0 2nd Bit (P0.5) SSD and FRC pin -- 35 Port 0 3rd Bit (P0.4) SSD and FRC pin -- 36 Port 0 4th Bit (P0.3) SSD and FRC pin -- 37 Port 0 5th Bit (P0.2) SSD and FRC pin -- 38 Port 0 6th Bit (P0.1) SSD and FRC pin -- 39 Port 0 7th Bit (P0.0) SSD and FRC pin -- 40 VCC VCC and FRC pin --

Page 8: 8051 kit manual

8051DK-6x10 Manual Page 8

Chapter 3

Software installation steps

Installation steps for RIDE.

1. Go to the folder named RIDE. 2. Double click on install.exe. 3. Click nextànextà…. and go ahead until the setup wizard is complete. 4. At the end click finish to complete the installation.

Installation steps for Philips Flash magic.

1. Double click on Flash magic.exe. 2. Click nextànextà…. and go ahead until the setup wizard is complete. 3. At the end click finish to complete the installation.

Page 9: 8051 kit manual

8051DK-6x10 Manual Page 9

Chapter 4

Connecting and powering up the kit

1. Power is provided to the kit through USB cable provided with the kit. 2. Connect the B side of the USB cable to the B type connector present on the

kit. 3. Connect the A side of the USB cable to USB connector of the

Laptop/desktop. 4. After connecting both ends of the cable, push the ON/OFF switch. 5. A small LED besides this switch turns ON to indicate that the kit is powered

up properly. 6. The serial cable provided with the kit is used to transfer the hex code from

the PC to the kit and also as a serial link between the kit and any other device while performing serial communication.

7. Connect one of the ends of the serial cable (Male connector) to the female serial DB-9 connector on the kit.

8. Connect the other end of this cable to the serial port of the computer (Desktop).

9. A USB to serial convertor may be used if the kit is to be connected to a Laptop.

10. There is no indication whether the serial link between the kit and computer is has been established. It is automatically verified once a program is transferred from the computer to the microcontroller successfully.

Page 10: 8051 kit manual

8051DK-6x10 Manual Page 10

Chapter 5

Tutorial on RIDE and Flash Magic

Executing sample programs using RIDE.

1. Open the RIDE software.

2. To make a new project: • Project New

• Specify a “Name”. • Directory where the project is to be stored. • Target family as 80C51. • Click “Next”. • Select the target device as: Atmel-AT89S52, or Philips-

P89C/V51RD2xx.

Page 11: 8051 kit manual

8051DK-6x10 Manual Page 11

• Clock on “Finish”

3. The place on the left hand side is the project window. It shows all the details about the project.

4. To create new file: File New C File.

5. Write your code into the window on the right and save it.

6. Right click on your project name in the project window and click on “Add node source/application”.

7. Brows the saved C-File and click ok. This includes the C-File in the project.

8. To generate .HEX file of the project press F9. The hex file is generated is there are no errors in the code.

9. The location of the .HEX file is shown at the bottom of the RIDE window.

Page 12: 8051 kit manual

8051DK-6x10 Manual Page 12

10. This file can be directly transferred to the microcontroller using Flash

magic.

Page 13: 8051 kit manual

8051DK-6x10 Manual Page 13

Programming the microcontroller P89C/V51RD2BN using Philips Flash Magic

1. Open the Philips flash magic software. 2. Make the following setting in the software:

• Select the appropriate COM port where the kit is connected. • Select the Baud rate (Generally keep it at 9600) • Select the device (89C51RD2xx or 89V51RD2) according to the

microcontroller place on board. • Place a tick on “Erase all flash”

3. Brows your code’s .HEX File I the hex file space.

4. Click on the “Start” button.

Page 14: 8051 kit manual

8051DK-6x10 Manual Page 14

5. The software gives a message “Reset the device in ISP mode now” (in case of 89V51RD2)

6. Turn the kit off by pressing the pushbutton switch (AC/DC) switch and then

switch it on. The above box disappears and the hex file gets transferred.

ALTERNATIVELY

6. At this point press the “BOOT” switch on the kit. Reset the device by pressing the “RESET” switch (while keeping the BOOT switch pressed), and then release the BOOT switch. The above window disappears and the .HEX file is transferred to the microcontroller.

7. After the software shows “Finish” (bottom right of the window) Press “RESET” switch to execute your program.

8. In case of 89C51RD2xx, select this device, locate the hex file, follow STEP 6 (above) and then press start button on the software.

Page 15: 8051 kit manual

8051DK-6x10 Manual Page 15

Chapter 6

Sample codes

Code 1 This code will blink LED’s connected at Port 1 alternatively.

Change the numbers 0xaa and 0x55 to change the pattern of the LED’s.

# include<reg51rx.h> main() { int t; P1=0xaa; for(t=0;t<50000;t++); P1=0x55; for(t=0;t<50000;t++); main(); }

Code 2 This code checks if any of the switches at port 2 is pressed and then blinks the LED’s at port 1. # include<reg51rx.h> void prog1(); void delay(); main() { int r; P2=0xff; if (P2!=0xff) {

Page 16: 8051 kit manual

8051DK-6x10 Manual Page 16

prog1(); } } void prog1(void) { P1=0x00; delay(); P1=0xff; delay(); main(); } void delay(void) { int t; for(t=0;t<50000;t++); }

Code 3 This code displays the count 0 to 9 on seven segment display interfaced on port 0. # include<reg51rx.h> main() { int t,i,u; static code char num[] = {0x7e,0x48,0x3d,0x6d,0x4b,0x67,0x77,0x4c,0x7f}; for(i=0;i<10;i++) { P0=num[i]; for(u=0;u<20;u++) { for(t=0;t<50000;t++);

Page 17: 8051 kit manual

8051DK-6x10 Manual Page 17

} } i=0; }

Code 4 Set the baud rate on hyper-terminal at 9600 bps /************************************************************/ /* this displays how to serially communicate without printf */ /************************************************************/ #include<reg51rx.h> void comsend(char *); void cominit(); void main() { cominit();//initialize UART for communication comsend("Hello World");//send the string while(1);//stop } void cominit() { TH1=-3;//timer 1 used as baud rate generator, gives 9600 baud TMOD=0x20;//timer 1 in mode 1 TR1=1;//start timer 1 SCON=0x50;//intialize UART } void comsend(char *dat)//read data { char data temp;//temporary for(temp=0;dat[temp];temp++)//count characters in the string

Page 18: 8051 kit manual

8051DK-6x10 Manual Page 18

{ TI=0; SBUF=dat[temp];//transmit character while(!TI);//wait for transmission } }

For more details visit: www.dicovermechatronics.blogspot.com Email: [email protected]

Cell: 09970825313