Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Quick Start Guide 8051 Development Kit

HPS_________________________________________________________________

1

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Information in this document, including URL’s and other internet website reference is subject to change without notice. No part of this document may be reproduced, stored in or introduced into a retrieval system or transmitted in any form or by means ( electronic , mechanical , photocopying , recording, or otherwise) or for any purpose without the express written permission of OM TECHNOLOGY CENTRE. © 2008, OM TECHONLOGY CENTRE. All rights reserved.

HPS_________________________________________________________________

2

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Contents

Overview of Development Board Installing software’s Getting started Projects Interfacing LED Interfacing switch and LED Demonstration of serial communication Getting help

4 5 6

14 16 18 20

HPS_________________________________________________________________

3

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Overview of Development board
This Development Board provides an easy and low cost way to develop projects based on 8051 microcontrollers without the need to purchase any other equipment such as programmer or emulators. All required software’s are available as free download, including a C compiler Note: All required software’s are included in accompanying CD.
5V Regulator PORT 0 I/O PINS PORT 3 I/O PINS

Microcontroller TTL to RS232 Converter

Serial cable Connector PORT 1 I/O PINS PORT 1 I/O PINS Power Input 8-25 V AC/DC Reset Switch

Features: 1. Standard 89C51RD2 CPU clocked at 11.0592 MHz. 2. All 32 I/O pins are available at the edge of the board. 3. Onboard TTL to RS232 level converter for easy PC interface. 4. Onboard rectifier and 5V regulator. 5. 5V and Ground are available on each port connectors for external interfacing. HPS_________________________________________________________________

4

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Installing Software’s
Software’s required to develop projects 1. Editor – is a program that allows you to edit plain text file including .c, .asm, .txt, . html, .php & many more. (Notepad) 2. Compiler – is a program that converts high level language into machine understandable (Binary) language. (SDCC, Keil) 3. Programmer – is a program which programs hex file into microcontroller. (Flash Magic) Installing Keil Software: Keil is IDE (Integrated Development Environment) for microcontrollers. 1. Open My computer. 2. Within the My Computer window, open the CD Drive, open Development Kit/Compilers/Keil. 3. Within Drive contains setup file, double click on this file should start installation, follow the instructions. 4. After installing a keil software if it prompts you to reboot the computer, do it. Installing SDCC (Small Device C Compiler): is freeware ANSI C compiler that targets Intel 8051 and many more. Follow the same steps as guided in the previous section, except locate the below file Development kit/compilers/sdcc/sdcc-2.7.0-setup Installing Flash Magic: is a pc tool for programming flash based Microcontroller Follow the same steps as guided in the previous section, except locate the below file Development kit/programmer/ FlashMagic.exe If errors are encountered during installation, this document will not cover those errors. HPS_________________________________________________________________
5

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Getting Started
After installing software’s it’s time to play with it. Compiling program using Keil µVision2. Follow below steps. Figures will guide you.

1. Run Keil software.

2. Select New Project from Project menu. HPS_________________________________________________________________
6

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

3. Type appropriate name for the project and click on Save.

4. A window Prompts Select Device for Target ‘Target1’. 5. Select ATMEL – AT89C51 in Data base and on click Ok. HPS_________________________________________________________________

7

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

6. From the File Menu select New, a new Text window appears.

7. Save the file by typing suitable file name with its extension .c (or asm). HPS_________________________________________________________________
8

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

8. Type your program and save it.

9. Right click on the folder named Target1 in the project window and select options for Target ‘Target1’. HPS_________________________________________________________________

9

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

10. In the output tab click on create HEX file and click on OK.

11. Expand Target1, a sub folder Source Group 1 appears in the project window. 12. Right click on the Source Group 1 select Add Files to Group ‘Source Group 1’ HPS_________________________________________________________________

10

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

13. Select the file (your program) then click on Add then Close window.

14. Click on Build Target in the Project Menu or press F7 HPS_________________________________________________________________

11

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

15. If there are no syntax errors a source file is compiled and a hex file is created in the directory in which the project is saved. This hex file is programmed into microcontroller using Flash Magic HPS_________________________________________________________________
12

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Configuring Flash Magic
Run Flash Magic and set below parameters.
1. Set com port to which development board is connected.(usually COM 1) 2. Baud Rate to 9600. 3. Device as 89V51RD2 4. Interface as None(ISP) 5. Check “Erase Blocks used by Hex File”. 6. Check “Verify after programming”.

Programming microcontroller by Flash Magic
Connect serial cable to PC and Development Board. Apply power to the board by connecting Power Adapter provided in the development kit. Run Flash Magic, Select Hex file and click on start. A message box appears saying Reset Device into ISP Mode. Reset the device by pressing push button on the Development Board. With a few seconds (depends upon the size of the code) Hex file is programmed into microcontroller. Reset device to execute program. That’s all. HPS_________________________________________________________________
13

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Projects
1. Interfacing of LED
Interfacing LED to microcontroller is the most basic interfacing which is similar to print “Hello World” on the screen in c programming language. Components required 1. LED 2. Resistor 3. Breadboard 4. Connecting wires Note: all components are included in our development Kit except BreadBoard. Hardware connection Note: Assuming the reader is similar with breadboard connection. Connect anode terminal (longer lead) of LED to resistor and another end of resistor to Vcc. Connect cathode terminal of LED to P1.0 (pin 1) of microcontroller using connecting wires. Software programming Copy paste (program if it is in pdf format) or write below program in the keil software and compile (follow Instructions in “Getting Started “ ) to get hex file. Program this hex file to microcontroller using Flash Magic. After programming is complete reset the device to execute your program. Now LED blinks approximately at 1Hz. Congrats!

HPS_________________________________________________________________

14

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________
/* -----------------------------------------Demonstration of interfacing an LED Designed for 89c51 running at 11.0592 MHz Hardware Connection Connect anode terminal (longer lead) of LED to Vcc through 330 ohm resistor. Connect cathode terminal of LED to P1_0 (pin 1) of microcontroller. Compile with Keil Compiler. Operation: when MCU power up LED blinks continuously at frequency of 1Hz. Feedback appreciated: prashanthbs_08@yahoo.co.in ----------------------------------------------------------------*/ //INCLUDES DEFINITION OF 89C51 #include<at89x51.h> // Includes definition of 89x51 //CONSTANT DEFINES #define INPUT_PIN 1 #define TRUE 1 //PINS DEFINE #define LED

// define 1 as INPUT_PIN // define 1 as true

P1_0

// define port P1_0 as LED

//FUNCTIONS PROTOYPES void main(void); void Delay(unsigned int time); //main function begins void main(void) { LED = INPUT_PIN; while(TRUE) { LED = !LED; Delay(1000); } } void Delay(unsigned int time) { unsigned char pause; while( time > 0) { pause = 150; while(pause--); time--;

// LED acts as input // loop forever // toggle LED // delay between toggle // end of while loop // end of main function

// Declare variable pause as unsigned char // loop until time is greater than zero // Initialize pause to 150 (decimal value) // Decrement pause until it becomes zero // Decrement time and loop back until time

} } // End of program

// value becomes zero // End of Delay function 15

HPS_________________________________________________________________

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

2. Interfacing switch and LED
Components required 1. LED 2. Resistor 3. Breadboard 4. Switch 4. Connecting wires Note: all components are included in our development Kit except Breadboard. Hardware connection Note: Assuming the reader is similar with breadboard connection. Connect one terminal of switch to ground and another to P1.1 (pin 2) of microcontroller using connecting wires. Connect anode terminal (longer lead) of LED to resistor and another end of resistor to Vcc. Connect cathode terminal of LED to P1.0 (pin 1) of microcontroller. Software programming copy paste(program if it is in pdf format) or write below program in the keil software and compile ( follow Instructions in “Getting Started “ ) to get hex file. Program this hex file to microcontroller using Flash Magic. After programming is complete reset the device to execute your program. Now press the switch, LED lights up, release light disappears. Cheers!

HPS_________________________________________________________________

16

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

/* ----------------------------------------------------Demonstration of interfacing switch and LED -------------------------------------------------------Designed for 89c51 running at 11.0592Mhz Hardware Connection ------------------Connect one terminal of switch to P1_1 (pin 2 pf microcontroller) and another terminal to ground. Connect anode (longer lead) of LED to vcc through 330 ohm resistor. Connect cathode of LED to P1_0 (pin 1) of microcontroller. Compile with Keil Compiler. Operation: when MCU power up, continuously copies the status of switch to LED Hence as along as switch is pressed LED lights up. ---------------------------------------------------------------------------Feedback appreciated: prashanthbs_08@yahoo.co.in ----------------------------------------------------------------------------*/ //INCLUDES #include<at89x51.h> // Includes definition of 8051 //DEFINE CONSTANT #define LED P1_0 #define SWITCH P1_1 #define INPUT_PIN 1 //FUNCTION DEFINES void main(void) { LED = INPUT_PIN; SWITCH = INPUT_PIN; while (1) LED = SWITCH; } //END OF PROGRAM // define port P1_0 as LED // define port P1_1 as switch // define 1 as INPUT_PIN

// main function begins //LED acts as input pin //Switch acts as input pin //loop forever //copies value of switch to led

//end of main function

HPS_________________________________________________________________

17

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

3. Demonstration of serial communication Components required None (all components are on the board). Hardware connection No Hardware connections. Smile on Face! Software programming Copy paste (program if it is in pdf format) or write below program in the keil software and compile (follow Instructions in “Getting Started “ ) to get hex file. Program this hex file to microcontroller using Flash Magic. After programming is complete reset the device to execute your program. Run Terminal v 1.9 (included in the CD) software. Set the parameters: COM Port - Com Port number to which development board is connected (usually COM1), Baud rate – 9600, Data bits – 8, Parity – None, Stop bits 1, Handshaking - None. Click on connect. Type Text in transmit window is echo back from your microcontroller. and click on send. The Message

HPS_________________________________________________________________

18

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________
/*----------------------------------------------------------------------------------------------------------------------------------------Demonstration of serial communication - ECHO program Designed for 89c51 running at 11.0592 MHz. Communication between PC and microcontroller. RS232 serial specification: 9600 baud rate, 8-bit , 1- Start bit, 1-stop bit, Parity none Hardware Connection Connect serial cable provided with 89c51 Development kit to Development board and PC. compile with Keil Compiler. Note: Hyper Terminal / Terminal v1.9b software required for communication Operation: receives data from PC (or any serial device) and transmit same data back to PC- A ECHO program Feedback appreciated: prashanthbs_08@yahoo.co.in --------------------------------------------------------------------------------------------------------------------------------------------*/ //INCLUDES #include<at89x51.h> //Includes definition of 89c51 //DEFINE CONSTANT #define Baud_rate 0xFD // for 9600 Baud rate //DEFINE PROTOTYPES void main(void); void SerialInitialize(void); void SendByteSerially(unsigned char ascii); unsigned char ReceiveByteSerially(void); //FUNCTIONS void main(void) { unsigned char serialdata; SerialInitialize(); while(1) { serialdata = ReceiveByteSerially(); SendByteSerially(serialdata); } } void SerialInitialize(void) { TMOD = (( TMOD & 0x0F) | 0x20); SCON = 0x50; TH1 = Baud_rate; TR1 = 1; } void SendByteSerially(unsigned char serialdata) { SBUF = serialdata; while(TI == 0); TI = 0; } unsigned char ReceiveByteSerially(void) { while(RI == 0); RI = 0; return SBUF; } // END OF PROGRAM

// kick start from here // declare serialdata variable as unsigned char // call routine to initialize serial communication // infinite loop // receive data from serial port // send data back to pc // end of main program // initialize serial communication // Timer 1 in Mode 2 to generate baud rate // serial mode 1, 8-data bit , 1-start bit , 1-stop bit , REN enabled. // load timer value // start timer

// load data to serial buffer register // wait until transmission to complete // clear transmission interrupt flag

// wait until data being received // clear flag // return serial data

HPS_________________________________________________________________

19

Quick Start Guide - 8051 Development Kit

OM TECHNOLOGY CENTRE

__________________________________________________________________________________

Getting help
Regarding doubts in programming the microcontrollers using this Development Board please feel free to call 09986257353 or contact by mail prashanthbs_08@yahoo.co.in

Regarding Development Board and Microcontrollers contact OM TECHNOLOGY CENTRE No 34,35, SPA Plaza, Opp Luciya Hotel, O.T.C Road, Bangalore-560 002 Email: otcbangalore@gmail.com Tel: 080- 41464573 OR OM ELECTRONICS No , SP Road Bangalore – 560 002

HPS_________________________________________________________________

20

Sign up to vote on this title
UsefulNot useful