You are on page 1of 30

Chapter 1

89S52 Basics

By DeccanRobots
What is 89S52?

 89S52 is a Microcontroller.
 It is based on 8052 Architecture
 In simple language we can consider
89S52 as Advanced Version of 89C51.

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


I have some Questions…

 Q. Do I need to be an Electronics
Engineer to learn 89S52?
 Ans: No. You need not to be an
electronics engineer to learn any
microcontroller. The only requirement is
you must have some knowledge of
electronics components and of any
programming language.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
I have some Questions…

 Q. I know electronics components like


transistor, resistance, capacitors but I
have very little knowledge of
programming language?
 Ans: What we expect from you is you
should be able to understand LOGIC
behind code.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
I have some Questions…

 Q. After learning 89S52 using this kit,


will I be in position to make my own
projects of industrial level?
 Ans: Yes. With the knowledge you will
gain and using this kit, you can develop
high end projects using LCD or RS232
or ADC etc.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
What is Microcontroller?

 Microcontroller is a combination of
Processor + Memory + Ports
 Microcontroller can be used for only
ONE application at a time.
 In other words, “Microcontrollers are
used for dedicated applications”

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


Comparison between
Controller and Processor
 Microcontrollers are also called as ON
BOARD Computers, because :
Microcontroller Pentium Computer
Small Processor Pentium IV Processor
Data Memory 128 MB RAM
Program Memory Hard Disk
Interfacing Ports Ports on backside of
computer
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
About Processor

 In previous slide, we have seen


comparison between microcontroller
and processor.
 In simple terms, Processors is not
useful in making a Project or application
because it does not have Memory and
Ports in built.

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


About Processor

 Hence Processors requires external


peripherals like RAM and PORTS and
Hard disk to function as Computer.
 But …..

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


About Microcontrollers

 But… Microcontrollers are “ALL IN ONE


PACAKAGE”.
 Any microcontroller available is made-
up of PROCESSOR + Program Memory
+ Data Memory + Ports.

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


About Microcontrollers

 Hence we DO NOT require any


additional circuit to develop basic
project like Water level controller or a
temperature indicator or a data logger.

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


Inside 89S52
89S52

General Purpose
Your Code is
Memory
Called as Stored Here
to store values
FLASH
Memory
Processor

Called as This layout is applicable to all


Internal microcontrollers. Each microcontroller
Memory will have different size of memory.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Inside 89S52

 In previous slide, you have seen 2


sections. 1] Flash Memory: It is used to
store your program. 2] Internal Memory:
It is used to remember values used for
calculations and decision making.
 Both memories are located INSIDE
controller.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Inside 89S52

 This much initial information is enough


for a beginner to start writing program
for 89S52.
 Another important information is,
programs you will learn in this tutorial
can be used for other microcontrollers
of same family like 89C51 / 89S51 /
89S53 / 89S2051 etc with some minor
changes
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Decimal, Binary and Hex

 Decimal, Binary and Hex are


Numbering System
 You must have basic knowledge of
relation between them.

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


Decimal, Binary and Hex

 Decimal numbering system is made up


of 0, 1, 2 … 9
 Binary numbering system is made up of
1 and 0
 Hex Numbering system is made up of
0,1, 2, 3 …..8, 9, a,b,c,d,e,f

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


Decimal, Binary and Hex

 Very Important:
– Following Numbers
10d ,10b, 10h Are NOT same
– 10d is 10 decimal
– 10b is 10 binary i.e. 2 decimal
– 10h is 10 hex i.e. 16 decimal

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


Decimal, Binary and Hex
 You can use calculator provided by
Windows in scientific mode to convert
these values.

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


89S52 Pin out These Ports can be used
as Input OR Output

PORT 1
PORT 0

PORT 3
PORT 2
Crystal

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


89S52 In-built Features

 8KBytes of In-system
Re-Programmable Flash Memory to
store your Program
 256 Bytes of Internal RAM to store
various values
 32 Input/Output Lines (Port Pins)

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


89S52 In-built Features

 Remember:
 From this slide onwards, whenever
Term “Memory” is used, assume it as
Data Memory.
 Data Memory is internal memory used
to store various values.
 In some cases if other type of memory
is be referred, it will be mentioned
clearly.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory
7 6 5 4 3 2 1 0 FFh

•Size of Data Memory


is 256 Bytes
•It is used to store
various values

7 6 5 4 3 2 1 0 02h
7 6 5 4 3 2 1 0 01h
7 6 5 4 3 2 1 0 00h
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory
7 6 5 4 3 2 1 0 FFh

•Size of Data Memory


is 256 Bytes
•It is used to store
various values

7 6 5 4 3 2 1 0 02h
7 6 5 4 3 2 1 0 01h
7 6 5 4 3 2 1 0 00h
Bit Numbers
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory

 Example for Data Memory usage:

MOV 03h,#55h

This statement will copy value 55h to


Memory Location 03h
(55Hex = 85Decimal = 01010101 Binary)
Refer Next Slide For more details
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory
0 0 0 0 0 0 0 0 FFh MOV 02h,#55h

0 1 0 1 0 1 0 1 02h
0 0 0 0 0 0 0 0 01h
0 0 0 0 0 0 0 0 00h
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory
0 0 0 0 0 0 0 0 FFh
Memory Location 00h
is also called as R0.

R0 is also called as a
Register
Hence:
MOV R0,#55h
R2 0 0 0 0 0 0 0 0 02h
And
R1 0 0 0 0 0 0 0 0 01h
R0 0 01 0 01 0 01 0 01 00h MOV 00h,#55h will do
the same work
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory

 Memory Location 07h is Known as R7


 Memory Location 06h is Known as R6
 Memory Location 05h is Known as R5
 Memory Location 04h is Known as R4
 Memory Location 03h is Known as R3
 Memory Location 02h is Known as R2
 Memory Location 01h is Known as R1
 Memory Location 00h is Known as R0
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory
FFh
General purpose
Memory Area

2Fh
Bit Addressable
Memory
20h
Registers
00h
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Data Memory

 Bit Addressable Memory Area will be


discussed in detail at appropriate time.

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


End of Chapter 1

 This is END of 1st Chapter


 Open 2nd Chapter to write your First
Code for 89S52

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

You might also like