0% found this document useful (0 votes)
49 views

89S52Basics2 FIRST PROGRAM

This document discusses writing a first program to turn on and off LEDs connected to an 89S52 microcontroller board. The program involves installing software, connecting the board to the computer, writing assembly code to set port 2 to binary 01010101, assembling and downloading the hex file to the board using HandyProg software. When the programming is complete, four LEDs will be on and four will be off as intended by the code.

Uploaded by

Paulo Mariano
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)
49 views

89S52Basics2 FIRST PROGRAM

This document discusses writing a first program to turn on and off LEDs connected to an 89S52 microcontroller board. The program involves installing software, connecting the board to the computer, writing assembly code to set port 2 to binary 01010101, assembling and downloading the hex file to the board using HandyProg software. When the programming is complete, four LEDs will be on and four will be off as intended by the code.

Uploaded by

Paulo Mariano
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/ 19

Chapter 2

89S52
Writing your First Program

By DeccanRobots
First Program

 Task of this program is very simple:


 You will find 8 Red LEDs on Interfacing
Board.
 You have to Make 4 LEDs ON and 4
LEDs OFF like this.

 We DON’T want Blinking effect now.


For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
First Program

 Before we proceed, make sure you


have following things ready:
– Install 8051IDE Software’s Evaluation
Version (Will be used to write code in
assembly)
– Install HandyProg software (Will be used to
download your program to 89S52)
– Switch ON Kit by connecting it to Mains.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
First Program

 Connect 9 Pin Serial Cable between


your Kit and computer.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

89S52 Target Section

Programmer
(HandyProg)

AVR Target Section


For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
First Program

 Locate 8 Pin connector near 8 LEDs


 Take 2 numbers of 8 Pin Connectors
provided with Kit.
 Join all wires of both the connectors.
Join wires color to color.
 Put one end in Port 2 of Target Board
and other end to LEDs connector.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
First Program
LED Points

Port 2

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

 To write program, Open 8051 IDE


Software

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

 Open New File

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

 Write this code and save your file:

MOV P2,#55h

This code will copy Binary 01010101 to


Port2

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

 Assemble your Program as shown here:

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

 You will find Output Window as shown:

NO Errors
NO Warnings

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

 Now Open 89S52 ISP Software

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program Automatically
Detect COM Port
 This is HandyProg Software

To OPEN Hex File

To Send Hex
File to KIT
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
First Program

 You can click on Menus


 To Download your code to 89S52 Open
Hex File as shown in next slide

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

 Select Hex File.


 You will find Hex file at same location
where you have
stored your
assembly program.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


First Program

Your Hex File will be


displayed in this software.

You can Click on “Program”


Hex to download your
program to 89S52.
As programming gets over, you will find
LEDs are ON as desired.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
More Details about First Program

 Always Refer “User Manual” provided


with this kit for more details like circuit
diagram and description.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


End of Chapter 2

 This is END of 2nd Chapter


 Open 3rd Chapter to learn
Bit Addressable Area of Data Memory

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India

You might also like