Documente Academic
Documente Profesional
Documente Cultură
.
Abstract – The 89S52 microcontroller (MCU) is very popular II. RESOURCE REQUIREMENT
among the students, teachers, amateurs, engineers, scientists, • IBMPC with WINXP Operating System.
and hobbyists for building electronics projects and consumer
products. Successful realization of MCU based products • MIDE-51 [2]: Assembler for 8051 microcontrollers.
depends on the sound understanding of architecture, instruction • TOP2005 [3]: ROM Programmer.
and interfacing of the MCU, which can be effectively acquired • MicroTalk-8085 [4]: Optional item. It provides
with the help of a ‘Microcontroller Learning System (MLS)’. hardware of the MCU trainer as the peripherals of the
The MLS provides facilities to enter program codes and data
8085 microprocessor are fully compatible with 8051.
into memory; program execution and debugging; checking and
changing memory/register contents; breadboard/edge connector III. EXPECTED FEATURES OF THE MCU TRAINER
for prototyping interfacing circuits; and viewing the result on
display devices. This paper presents the design and development The trainer wills have the following hardware and software
procedures of an 89S52 MLS system along with examples to features to perform experiments for learning the 8051
establish its effectiveness in learning microcontroller hardware interfacing and its programming.
and programming. We designed, developed, and tested a
prototype MLS system named MicroTalk-8051 Trainer. A. Hardware Features
• 89S52 MCU with internal Flash disabled.
Keywords – 89S52, CISC architecture, microcontroller • 2x8-Kbyte EPROM for holding the codes of the
learning system, MLS, MicroTalk-8051, GUI interface. Monitor Program and the Subroutines.
I. INTRODUCTION • 8-Kbyte external RAM for loading users’ programs.
• 8279-based 6-digit CC-type display unit.
The 8051 is the generic name for the microcontrollers
• 8279-based Keypad with 17 Command/Data keys and
89C51, 89S51, 89C52, 89S52, 89S8252, and the like. All
1 Reset key arranged in 6x3 matrix.
these MCUs share a common basic architecture and an
instruction set. The 8051 is a single chip IC housed in a • RS232/USB interface for downloading program codes
40-pin DIP package. It contains hardware resources, which and data from the IBMPC.
are: 8-bit and 1-bit processors known as Byte Processor and • IO connectors and breadboard for circuit interface.
Boolean Processor, Clock Oscillator, Special Function B. Software Features
Register Set, Code Memory (Flash) with Security Bit, Data
Memory (EEPROM) with Security Bit, RAM, Parallel IO, • EXA Command to open the address of an external
Asynchronous Serial IO, Counter/Timer, High Speed Serial memory location.
Peripheral Interface (SPI), In System Programming Interface, • CHG Command to change the content of an external
and Parallel Programming Interface. memory location.
To learn the functionalities of all these resources and their • FRW/BKW Commands to check next/previous
interfacing with IO devices, one requires owning a memory and register location.
‘Microcontroller Learning System’, where he can experiment • DOP Command to execute a program.
all kinds of trial-and-error approached hardware interfacing • PCR & S/S Command to execute only one instruction.
and the software programming. The user may own a learning • GPR Command to check General Purpose Register.
system through purchase or by making it himself. In this • CSR Command to check Control & Status Registers.
paper, we have documented design methodology of an MLS, • TCR Command to check Timer & Counter Registers.
which the serious readers may adopt to build their own • DPR Command to check Data Pointer Register.
Trainers and spend times to learn everything (!) of the 8051 • PSR Command to check Processor Word Register.
microcontroller. • SPR Command to check Stack Pointer Register.
There are many companies [1] around the world, who • ICR Command to check Interrupt Control Registers.
manufacture and distribute 8051 trainers among the • Subroutines to convert data & access display/keypad.
educational and industrial institutions for learning purposes.
These trainers accompany user manual, laboratory D
DO P 01
E
EXA 09
F
FRW 11
experiments, and schematics of the hardware but no A
AUT 02
B
BKW
C
CHG
0A 12
information at all on the working principle of ‘Monitor 7 8 9
TIR 03 GPR 0B CSR 13
Program (MP)’ and its design methodology. MP is a 4 5 6
SPR 04 PCR 0C DPR 14
specialized program, which usually resides in the EPROM of 1 2 3
RAM 05
the trainer and decodes the keypad commands for code/data ICR 0D PSR 15
BKS 0
entry, program execution, memory/register check and change, RST
S/S 0E PRT 16
and finding the erroneous instruction (s) of a faulty program. Fig. 1 Pictorial view of MicroTalk-8051 with Keypad Layout
Fig. 2 Hardware Block Diagram for the 89S52 Microcontroller Learning System
98
Proceedings of 2015 3rd International Conference on Advances in Electrical Engineering
17-19 December, 2015, Dhaka, Bangladesh
007A 035E
N
key closed Backspace
? Routine
Y Y
007D 00B3, N
0340 00B6
Is disp BKS
_ _ _ _ Ad ? ?
N
0086
Y, f0=1
Is disp
0089, 0100
XXXX XX ?
N Print at:
Y 008C Y SUR4
D6D5D4D3
0095 FRW 0109 0530
Is EXA D2D1
1--> f0 ?
?
1--> f2 N
N Forward KBP:
4--> #DP Show: 0106,
0092, 01A0 Routine Print
D6-->PP _ _ _ _ Ad 0128 00C0
KBP:011F End?
Y Y Y 0037
KBP:00A7 Is DOP BKW
01A9 0131 00BD Y
? ? 00D0
1--> f0 00D6 for: EXA
1--> f4 N N Backward f0, f1 00DC
4--> #DP Show: 01A6, 0210 012E Routine =1?
35-->PP _ _ _ _ dO 0150 1--> f1
Y KBP:0141 0-->f0, f2
KBP:01C1 Is AUT Show:
CHG 0159 4--> #DP
? 1--> f0 XXXX XX
1--> f0 Y ? D6-->PP
1--> f5 0219 1-->f3, f1
N Change KBP:00FE
4--> #DP Show: N 2--> #DP
35-->PP _ _ _ _ Ad 0216. 02A0 0156 Routine 31-->PP
Y KBP:016D
KBP:022E
Is PCR PCR 0309
Y
Y ? ?
0176 for:CHG
1--> f0 02A9 N
1--> f07 Show: N Home f0, f3
02A6, 0300 0306 Action =1?
_ _ _ _ PC
KBP:0325 1--> f1
N Show: 0-->f3, f0
0170 XXXX _ _ 35-->PP
N Y
Y
037C 0176 KBP:0197
S/S 0379
? f0, f4 01D6 for:DOP
=1?
Jumo to
REG Users Prog
EXA?CHG?
Loop/KBP
Y
KBP:E4B6 0246 for AUT
f0, f5
=1? 1--> f6
Exam/Edit Execute
0-->f5
Regs. Curr. Instruc Sow:
31-->PP
XXXX__
2 --> #DP
00A7
KBP:0258
KBP:02BB KBP:0037
Fig. 4 Flow Chart for the Complete Monitor Program of MicroTalk-8051 Trainer
A Microcontroller Trainer interacts with a user by virtue the display. Now, the user may enter 1-byte (2 digits, say
of its EPROM-resident Monitor Program. The following are D2) program code in the memory location. After code
the essential components of a MP, which once developed entry, the display becomes C000 D2.
could lead to the easy development of other components: • Sense FRW command and show the next memory
• Sensing EXA command and responses by showing the location and its content on the display as C001 XX. Now,
message _ _ _ _ A d in the display unit meaning that the the user can employ FRW and CHG commands to finish
user may now enter 16-bit address (as 4 hex digit) of a the entry of all the program bytes in memory.
RAM location. Assume that the RAM location is C000. • Sense DOP command to accept the beginning address of
• At the end of address entry, the display shows C000 XX. the loaded program, execute the program, and show result
• Senses the CHG command to show message C000 _ _ on on the display.
99
Proceedings of 2015 3rd International Conference on Advances in Electrical Engineering
17-19 December, 2015, Dhaka, Bangladesh
develop the hardware circuits and the software routines for 35 CC (DP0)
34 CC (DP1)
Display RAM DP0 DP5
the trainer. In SSS methodology, a basic hardware circuit and DRAM0 00H DP0
CC-Table
33 CC (DP2)
SUR1 DRAM1 01H DP1
its associated software codes are developed and tested. After 32 CC (DP3)
DRAM2 02H DP2
31 CC (DP4)
that, we add another incremental amount of hardware and 30 CC (DP5)
DRAM3 03H DP3
software with the previous one and test them. We will try to Internal RAM
DRAM4
DRAM5
04H
05H
DP4
DP5 Within Flash
develop the hardware on breadboards. However, at some 39 DP0DP1
Hex Table
DRAM6 06H DP6 LUT1
38 DP2DP3 SUR2 ScodeVsCC
stage of development, the trainer might stop working due to 37 DP4DP5
DRAM7 07H DP7
LUT2
too many jumpers and noise. At this time, either we have to CCVsDigit
LUT3
use the ready-made hardware of the MicroTalk-8085 trainer DigitVsCC
or placing the components on manually PTHed double Fig. 6 Data Structure and Lookup Tables
layered PCB (Fig. 5). B. Sense EXA Command and Show _ _ _ _ A d on Display
D P 0 ----------------D P 5 Listing – B
XTAL
R e se t
U 12 L21: If (scan code != 09H)
U1 U4 ADC Goto L21
U6 (0 8 04 )
L22: LH → flag1
U 10 Write cc-codes for _ s into CC-Table
Call SUR1 to transfer CC-Table to Display RAM of U9
U3 Enable printing logic for address field
U9
IOC
100