M51-02
M51-02
M51-02
8051 MICROCONTROLLER
TRAINER KIT
M51-02
M51-02
8051 Microcontroller Trainer
Table of Contents
1. System Introduction 4
2. System Specification 5
3. System Capabilities 6
4. System Installation 6
5. Hardware Description 7
6. Function of Reset 15
7. Keyboard Description 20
8. Serial Command 31
9. Memory /IO Mapping 38
10. Subroutines 39
11. Sample Programs 43
12. Connectors 50
13. Jumper Details 52
14. Appendix 53
15. 8051 Pin Details 61
16. 8051 LCD Kit Layout 62
17. Warranty 63
System Introduction
General Description :
M51-02 is a single board Microcontroller Training/Development Kit configured
around the most popular Intel’s 8051, 8 bit single-chip micro controller. M51-02 is
about the architecture, instruction set and capabilities of the 8051 chip and also for
actually controlling any industrial process.
The Kit communicates with the outside world through a 101 ASCII Keyboard and
20x2 Liquid Crystal Display (LCD). The kit has the capability of interfacing with an
IBM-PC compatible PC system through Serial Port.
M51-02 provides 32K bytes of user's RAM and 16K bytes of EPROM. The total on
board program & data memory can be very easily expanded to 64K bytes in an
appropriate combination of RAM.
The Input/Output structure of M51-02 provides 48 programmable
I/O lines using two nos. of 8255. It has got 16 bit programmable Timer/Counter for
generating any type of counting using 8253.
The Kit has RS-232C interface using Rx & Tx of 8051. It also has Optional AUX
Serial Port using 8251 for any serial communication.
This Kit has Optional 12 Bit ADC using AD574, 8 bit DAC using DAC0800, Real
Time Clock & Printer Interface.
The on board resident system monitor software is very powerful and provides various
software utilities. The kit provides various powerful software commands like Block
Move, Fill, Set./CLR Breakpoints, Single Stepping, Modify Memory/Register, Line
Assembler/Dissembler etc. which are very helpful in debugging/developing the
software.
The system also provides a serial monitor covering most of the commands available
in keyboard mode. A help menu makes the monitor more user friendly.
M51-02 is configured around the internationally adopted Bus, which is the most
popular bus for process control and real time applications. All the address, data and
control lines are available at 40 pin & 10 pin FRC connector. The Kit is fully
expandable for any kind of application.
System Specifications
CPU : 8 bit Microcontroller using 8051/89C51/89C52
operating @ 11.0592 MHz (Kit configured as
89C52).
Monitor EPROM : 16K bytes of EPROM loaded with powerful monitor
program.
RAM : 32K bytes of user's RAM using 62256 expandable
upto 64K.
Battery Backup : 3.6V Ni-Cd battery for user RAM.
Timer : 16 bit programmable timer/counter using 8253 &
External Timer T0, T1 from 8051.
I/O : 48 I/O lines using 8255 PPI chips & 14 I/O lines
provided by 8051.
Interrupts : Two external interrupts INT0 & INT1 from 8051.
Keyboard : 101 ASCII Keyboard.
Display : 20x2 Backlite LCD Display.
Optional Interface : 1 Channel 12bit ADC using AD574
: 1 Channel 8bit DAC using DAC0800
: Printer Interface
: Real Time Clock (RTC) using 6242
Serial Interface : 1) One serial UART interface provided by 8051.
2) One AUX RS-232C through 8251 with a
programmable baud rate(Optional)
BUS : All data, address and control signals (TTL
compatible) available at FRC connector
Power Supply : In-Built +5V/1A & ±12V/250mA.
Physical Size : 24cm x 15.5cm.
Operating Temp. : 0 to 50°C.
System Capabilities
101 ASCII Keyboard Mode :
1. Examine the contents of any memory location.
2. Modify the contents of any of the RAM location.
3. Move a block of data memory to program memory.
4. Examine/Modify the contents of Register
5. Move a block of program memory to program memory.
6. Fill a particular memory area with a constant.
7. Transmit an Intel Hex file from memory to an IBM PC Compatible computer.
8. Receive the Intel Hex file into memory from an IBM PC Compatible computer.
9. Execute a program at full clock speed.
10. Execute a program in single step i.e. instruction by instruction.
11. Set a Break Point.
12. Clear a Break Point.
13. Enable a Break Point.
14. Disable a Break Point.
15. Display a Break Point.
Note: All the above commands can be operated through Serial mode provided.
System Installation
Keyboard Mode :
To install M51-02 in keyboard mode, the following additional things are required.
1. Connect the AC power supply through AC power chord provided to the M51-02
kit.
2. Switch on the power supply at the rear end.
3. The below message will come on LCD screen:
8051 TRAINER KIT
After some time the operating commands will be displayed as below:
COMMAND : A, B, C, D, E, F,
G, I, L, M, N, P, R, S, T, Y
4. Now M51-02 Kit is ready for the user's experiments for keyboard mode
commands.
Serial Mode :
To install M51-02 in serial mode, the following additional things are required.
1. Steps 1, 2 and 3 of Keyboard Mode will remain same for Serial Mode.
2. Connect RS-232C Cable from PC Serial Port (Com-1 OR Com-2) to the
connector CN8 of the M51-02 Kit.
3. Switch ON the Hyper Terminal of Win95/98/2000/NT/XP and set the Baudrate
at 9600bps.
4. Press `Y' Key on ASCII Keyboard of M51-02 Kit. The below message will
display on LCD Screen. Now M51-02 Kit is ready for the user's experiments
for Serial Mode commands.
SERIAL PC COMUNICATN
Hardware Description
CPU :
The system has got 8051 as the Micro-controller operating at a crystal frequency of
11.0592 MHz. The 8051 Micro controller is an 8 bit CPU with on chip oscillator and
clock circuitry, 8 input/output lines, Two 16 bit timer/counters, a fire source interrupt
structure, full duplex serial port and built in Boolean processor. The chip has the
capacity to address 64K bytes of external data memory and 64K bytes of external
program memory.
Memory :
M51-02 provides 32K bytes of CMOS RAM using 62256 chip and 16K bytes of
Powerful Monitor EPROM. The total on board program/data memory can be
expanded up to 64K bytes.
I/O Devices :
The various I/O chips used in M51-02 are 8255, 8253, 8251, AD574, DAC0800 &
RTC6242. The functional role of all these chips are given below:
8255 :
8255 is a programmable peripheral interface (PPI) designed to use with
Microprocessor/microcontrollers. This basically acts as a general purpose I/O device
to interface peripheral equipments to the system bus. It is not necessary to have an
external logic to interface with peripheral devices since the functional configuration
of 8255 is programmed by the system software. It has got three Input/Output ports of
8 lines each (Port-A, Port-B & Port-C). Port-C can be divided into two ports of 4 lines
each named as Port-C upper and Port-C lower. Any Input/Output combination of
Port-A, Port-B, Port-C upper and lower can be defined using the appropriate software
commands. M51-02 provides 48 Input/Output lines using two 8255 chips. All I/O
lines are brought out at 26pin FRC Connector CN3 & CN4.
8253 :
This chip is a programmable interval Timer/Counter and can be used for the
generation of accurate time delays under software control. Various other functions
that can be implemented with this chip are Programmable rate generator, Even
counter, Binary rate multiplier, Real time clock etc. This chip has got three
independent 16 bit counters each having a count rate of up to 2MHz. The first
Timer/Counter (i.e. Counter 0) is being used for baud rate generation for RS-232C
interface. The other timer/counters are available to the user at 10pin FRC connector
CN5.
8251 :
This chip is a programmable communication interface and is used as a peripheral
device. This device accepts data characters from the CPU in parallel format and then
converts them into serial data characters for the CPU. This chip will signal the CPU
whenever it can accept a new character for the CPU. The CPU can read the complete
status of it at any time. 8251 has been utilized in M51-01 for AUX RS-232C interface
are available 9 pin D-type Connector CN9.
Optional Interface :
M51-02 provides Additional optional interfaces of Single Channel 12 bt ADC using
ADC547, Single Channel 8 bit DAC using DAC0800, Real Time Clock using RTC
6242. Using this interface one can configure for any Process Control Applications.
Battery Backup :
The M51-02 provides a battery back up for the onboard RAM area using 3.6V Ni-Cd
Rechargeable battery. M51-02 has facility for connecting +5V to the RAM area if the
Ni-Cd battery fails. The selection for +5V or Battery supply are available at Jumper
(JP1).
Display :
This display contains 2 lines and each line consists of 20 words (20x2). This is a
cursor LCD display modular. The CPU receives each 8 bits letter which is locked
into the internal display data of RAM (data display of RAM 80 bytes (D.D.RAM)
allows 80 characters to be stored), and transfer to 5x7 dot of array word and appear on
the displayed.
This LCD modular contains the word generator ROM that will supply 160 different
5x7 dot of array word and also a 64 bytes word generator RAM. Users can define 8
types 5x7 dot of array word.
The position of word display goes into the LCD Modular through the data bus in
CPU. Next through the instruction register and finally write the words into the data
register to display on a specific location. The LCD Modular will automatically
increase or decrease the words in order to move to different addresses. The user can
therefore continue sending in word code. The cursor as to moved around or moved in
the right of left direction.
Specification of Display :
1. Display data RAM : 80x8 BLT (80 words)
2. Character generator ROM : 160 of 5x7 dot of array word
3. Character generator RAM : 8 different users programmed 5x7 dot of
array
4. Kinds of instructions : Clear the display, send cursor home
(HOME), ON/OFF display. Cursor
ON/OFF, character blinking cursor move
to another position, display change
position.
5. When the internal power is on, the circuit is reset.
6. Internal circuit vibrator.
Note :
Some models incorporate a temperature compensation circuit within the bias voltage
generator
The LCD modular has 2 8-bits register-one instruction register (IR) and one data
register (DR).
The instruction register stores the instruction code and address information, which
contains display data RAM and address of character generator RAM. However, the
content of IR is only for read-in but not read-out.
The data register can only temporary store data, the input data first goes through LCD
and is stored in the data register. It will then automatically be transferred to display
data RAM or character generator RAM. When the CPU read the data from the
displayed RAM or from the character generator RAM, it will also temporary store the
data in the data register. When the address information is input into the instruction
register, the relative data will be moved from display register RAM or character
generator RAM to the data register. Then the data can be read from data register by
using the output instruction of CPU.
One way to select the two registers is to select the register signal (RS) like follow:
RS R/W Function
0 0 Data Bus —> instruction Register
0 1 Read out busy flags (BUSY FLAG DB7) and address counter (DB0-
DB6)
1 0 Input into data register and execute the inner instruction:
(D.R.RAM—> D.R. OR C.G.RAM — D.R.)
1 1 Get the data out form register, and execute the inner instruction:
(D.D.RAM—> D.R. OR C.G.RAM—> D.R.)
Busy Flag (B.F.)
When busy flag is “1”, it indicates that the LCD Modular is executing the inner
instruction and no other instruction can be accepted. The LCD Modular can only
accept information when BF is lower to “0”.
Address Counter (A.C.)
The address counter is used to count the display data RAM, or address of character
generator RAM. When the address setting instruction address will be sent into the
address counter.
When the data is sent into or read out from display register RAM or from the
character generator RAM, the address counter will automatically add or subtract 1.
When the content of address counter is in RS = 0 and R/W = 1, the output data line is
DB0 DB6.
Character codes :
Note :
1. The CG RAM generates character patterns in accordance with the user’s
program.
2. Shaded areas indicate 5x10 dot character patterns.
Character code :
Note :
1. The CG RAM generates character patterns in accordance with the user’s
program.
2. Shaded areas indicate 5x10 dot character patterns.
2. CG RAM address bits 0-2 designates the row position of each character pattern.
The 8 th row is the cursor position. CG RAM data in the 8th row is OR’ed with
the display cursor. Any “1” bits in the 8th row will result in the displayed dot
regardless of the cursor status (ON/OFF). Accordingly, if the cursor is to be
used, CG RAM data for the 8th row should be set to “0”.
3. CG RAM data bits 0-4 correspond to the column position of each character
pattern bit 4 corresponding to the leftmost column of the character pattern CG
RAM data bus are not used for displaying character patterns, but may be used as
a general.
4. As shown in tables 2 and 3, character patterns in the CG RAM are accessed by
character codes with bits 4-7 equal to “0”. For example, the character code “00”
(HEX) or “80” (HEX), since bit 3 of the character code is a don’t care bit (i.e.
can take either value “0” or “1”).
5. CG RAM data “1” produces a dark dot, and data “0” produces a light dot in the
corresponding position on the display panel.
Functions of Reset
Using the Internal Reset Circuit To Start
LCD Modular internal has an automatic power supply to be used to RESET when the
power rises. During RESET, the busy flag is set. When the voltage is raised to 4.5V
in about 10ms, it is in the busy stage. The following instructions are then used to set
the beginning stage of LCD.
1. Clear display
2. Function set
DL = 1 8-bit data length interface
N = 0 (single line display)
F = 0 The source of 5x7 dot of array character
3. Display ON/OFF control
D = 1 Display OFF
C = 0 Cursor OFF
B = 0 Character flashing function OFF
4. Entry mode set
I/D = 1 Increase mode
S = 0 Display OFF
Note : If the time for the power to increases from 0.2V to 4.5V is greater than 0.1ms
but less than 10ms, the current cut-off will drop to 0.2V before it rises again. If it
takes more than 1ms, the LCD modular will automatically RESET. Otherwise, it has
to depend on an external software instruction to RESET (As describe below).
Note :
1. Symbol “*” signifies a “don’t care” bit
2. Correct input value for “N” is predetermined for each model
Initialization by Instructions :
If the power conditions for the normal operation of the internal reset circuit are not
satisfied.
LCD unit must be initialized by executing a sense of the instructions. The procedure
fro this initialization process is as follows.
Instruction Description
When the LCD is controlled by the CPU, only the instruction register (IR) and the
data register (DR) can be read directly by the CPU. The commands from outside the
modular can decide the internal operation of LCD. These commands include the
register selection (RS) signals, read/write (R/W) signals, and data buffering signals
(DB0-DB6).
Table 5 lists all the useful commands in the LCD modular and the execution time,
these commands are divided into the following group:
1. Commands of set LCD module
2. Commands of internal set address RAM
3. Commands of data transfer in or out from the internal RAM
4. Other commands
When the LCD modular is executing a command it will reject other commands.
Except the “busy flag/read address counter, the internal counting period of busy flag
is set to as “1”. If the CPU wants to send in other commands it will have to check the
busy flag first, until it is cleared to “0” before it send in. The explanation is as
followed:
Display Clear Command
This command will put the display data into a empty space” code (20H), address
counter will be cleared to 0. When executing this command, display OFF, the cursor
or the character blinking function will be moved to the most left side if it is in the set
condition.
Display/Cursor Home
The address counter will be cleared to 0, content of D.D. RAM will not be influenced;
but if the cursor or the character blinking function is in the set condition, it will be
moved to the most left side position.
Entry Mode Set
I/D bit = “1”, “1” is added in the address counter after each time it read/write a
display data RAM character code, so that the cursor or the character blinking function
will move one place to the left and vise-versa when I/D=0. The read/write (R/W)
character generator also has the same function.
S bit = 1, but each time it read/write a display data RAM code, it will move to the
display direction and move one space to the left (I/D=0) or one space
to the right (I/D=1). When S=0, the display will not move.
When data enters the character generator RAM, the display will not move.
Display On/Off
D: D=1 - Display ON
D=0 - Display OFF
C: C=1 - Cursor display on the display address of the display counter
C=0 - Cursor does not display
B: B=1 - Character blinking of cursor position at feq or fosc=250KHz freq,
therefore all black points and character display will exchange with
each other. Each character display and overshadow 409.6ms.
Display/Cursor Shift
S/C R/L
0 0 - Cursor move to the left (AC <—AC-1)
0 0 - Cursor move to the right (AC <—AC+1)
1 0 - All the characters and cursor move to the left
1 1 - All the characters and cursor move to the right
Note : When the display moves, the address counter will not move.
Function Set
DL : Select data length for the interface circuit.
DL=1 - Using the 8 bits data length.
DL=0 - Using the 4 bits data length.
N : Select the display format (one or two lines)
C.G. RAM Address Set
Address counter and character generator RAM have address which are driven by the
binary 6-bit. when this instruction is driven in, data can be sent into the CPU and
character generator RAM.
D.D. RAM Address Set
Address counter and display data RAM have addresses which are driven by the binary
7-bit. When this instruction is driven in, data can be sent into the CPU and the
display data RAM. When N=0 (a single line display), binary code ADD between 00H
and 4FH; when N=1 (a two lines display), the binary code ADD from 00H until 27H
as the first line of from 40H until 67H as the second line.
Read Busy Flag/Address Counter
The busy flag (BF) in LCD can be read from the CPU, using the instruction of LCD
modular is the execution of the internal instruction BF = 1 represents the busy stage
(execution of the internal instruction), it will not accept any instruction at this time
until BF = 0.
Content of address counter and the busy flag will be read out at the same time, it is a
7-bit binary, the address counter will instruct one of the address, either the character
generator RAM or display data RAM. This is determined by the final input address
set instruction.
Send Data Into C.G. RAM/D.D. RAM
Data with 8-bit in length can be sent into the character generator RAM or the display
data RAM. The address of the input data is instructed by the address counter,
however, the address of address counter is influenced by the final input address set
instruction.
After data input whether the address counter add 1 or minus 1 is determined by the
design of the module. It can also be designed as location movement of the display.
Read Data Out of C.G. RAM/D.D. RAM
Character generator RAM with 8-bit in length or the display data RAM can be read by
the CPU. The read out data address is instructed by the address counter. The address
counter is instructed by the final input address set instruction.
This instruction has to be set in C.G. RAM/D.D. RAM address, once shift cursor
instruction of the C.G. RAM/D.D. RAM data is read out, no other instruction can be
read out.
The address setting instruction will read the data address into address counter.
Shift cursor command will allow the previous address setting to be used again in order
to read the D.D. RAM data. the data can be read from the C.G. RAM/D.D. RAM
after the cursor shift.
After the execution of data address counter add 1 or minus 1 will be set in the LCD
modular.
After the execution of data read out, the display will not shift.
Keyboard Commands
The operation of this device is simpler by using 101 ASCII Keyboard and 20x2 LCD
Display. For convenience, the operation instructions will be displayed when the
device is being switched on or RESET.
After power ON the system, it will display as follows:
8051 TRAINER KIT
Now press `ENTER' key on the ASCII Keyboard. The LCD screen will change as
follows.
3000 : _
Example :
Addition of two bytes.
3000 MOV A,#02H
3002 MOV R0,#03H
3004 ADD A,R0
3005 SJMP 3005H
Now enter the above example in the kit. Pick the first instruction in the LCD Kit
using ASCII Keyboard.
3000 : MOV A,#02H
As user press the `ENTER' key the fist instruction is accepted by kit and has
converted into the corresponding HEX code. Now Kit LCD screen will change as
follows.
3002 : _
If the instruction is wrong the kit will not accepted the instruction and the address will
remain same as follows.
3000 : _
In this way user can enter whole program as below using `ENTER' key.
3002 : MOV R0,#03H
D - Dissembler
The Disassemble command decodes the value of group memory location mnemonics
and display on the LCD screen.
COMMAND : A, B, C, D, E, F
G, I, L, M, N, P, R, S, T, Y
Simply Press the key ‘D’. After the command, the LCD screen will be blank.
Now press `ENTER' key on the ASCII Keyboard. The LCD screen will change as
follows.
3000 = 74 02
MOV A,#02H
By pressing further `ENTER' Key the address will be automatically incremented with
mnemonics and corresponding code. To terminated this command press `ESC' Key.
M - Examine/Modify Memory
The Examine/Modify memory command use to examine OR Modify any memory
contents in the Kit.
COMMAND : A, B, C, D, E, F
G, I, L, M, N, P, R, S, T, Y
Simply Press the key ‘M’. After the command, the LCD screen will be displayed as
below.
ENTER ADDRESS
Example :
Change Data 75 in the place of old data 74.
Type data 75 with the help of ASCII Keyboard on the LCD screen.
ENTER ADDRESS
3000 - 75
Now press `SPACE BAR' key on the ASCII Keyboard to Modify the RAM location.
Now LCD screen display as follows.
ENTER ADDRESS
3001 - 02
To terminate this command press `ENTER' Key.
R - Examine/Modify Register
The Examine/Modify Register command use to examine OR Modify any Register
contents of 8051 in the Kit.
Simply Press the key ‘R’. After the command, the LCD screen will be display as
below.
Now press `SPACE BAR' key on the ASCII Keyboard to Modify the
Register. Now LCD screen display as follows.
G - Execution
The Execution command use to execute the entered program in full clock speed.
Simply Press the key ‘G’. After the command, the LCD screen will be display as
below.
Syntax :
<RAM Starting Address> <ENTER>
If the Program starting address is 3000 location then type RAM starting address 3000.
Now press `ENTER' key on the ASCII Keyboard to Execute the program from 3000
location. Now the LCD screen will display as below.
Simply Press the key ‘N’. After the command, the LCD screen will be display as
below.
Syntax :
<RAM Starting Address> <Space Bar>
If the Program starting address is 3000 location as per example given in the (manual)
then type RAM starting address 3000.
Now press `SPACE BAR' key on the ASCII Keyboard to Single Step the first
instruction. Now the LCD screen will display as below.
To do further single stepping press `SPACE BAR' Key. To terminate this command
press `ENTER' key. The display on the LCD screen as below.
Note :
To Examine Registers while doing single stepping don't press
`RESET KEY'.
B - Block Move
The Block Move command use to move the block from one memory area block
location to another memory area block location.
Simply Press the key ‘B’. After the command, the LCD screen will be display as
below.
Syntax :
<Source Start Address> <Space> <Source End Address> <Space>
<Destination Start Address> <ENTER>
Block Move the Program as per example given in the (manual) i.e. 3000 - 3006 to
4000 destination location.
Now press `SPACE BAR' key on the ASCII Keyboard and the LCD screen will
display as below.
Now enter the End Address i.e. 3006 and the LCD screen will display as below.
Press `SPACE BAR' key on the ASCII Keyboard and the LCD screen will display as
below.
Now enter the Destination Starting Address i.e. 4000 and the LCD screen will display
as below.
Press `ENTER' key on the ASCII Keyboard and the LCD screen will display as
below.
By using Examine/Modify Memory i.e. `M' command, one can verify the Block
Move data in 4000 location.
F - Block Fill
The Block Fill command use to fill the block of memory with a constant data.
Simply Press the key ‘F’. After the command, the LCD screen will be display as
below.
Syntax :
<Source Start Address> <Space> <Source End Address> <Space>
<DATA> <ENTER>
Fill the Block with a constant data 55 from 3000 starting location to 30FF ending
location.
Now press `SPACE BAR' key on the ASCII Keyboard and the LCD screen will
display as below.
Now enter the End Address i.e. 30FF and the LCD screen will display as below.
Press `SPACE BAR' key on the ASCII Keyboard and the LCD screen will display as
below.
Now enter the Data to fill the memory block and the LCD screen will display as
below.
Press `ENTER' key on the ASCII Keyboard and the LCD screen will display as
below.
By using Examine/Modify Memory i.e. `M' command, one can verify the Block Fill
data in 3000 location.
T - Set Break Point
The Set Break Point command use to Set the Break Point at desired address.
Simply Press the key ‘T’. After the command, the LCD screen will be display as
below.
Syntax :
<Address of the Break Point to be set> <ENTER>
As per the Example given in the (manual) one want to set a Break Point at 3005
location. The Break Point address should always at the end of instruction.
Press `ENTER' key on the ASCII Keyboard and the LCD screen will display as
below.
Simply Press the key ‘E’. After the command, the LCD screen will be display as
below.
Press `ENTER' key on the ASCII Keyboard and the LCD screen will display as
below.
Simply Press the key ‘I’. After the command, the LCD screen will be display as
below.
After viewing the Break Point press `ENTER' Key and the LCD screen will display
as below.
Simply Press the key ‘C’. After the command, the LCD screen will be display as
below.
Press `ENTER' key on the ASCII Keyboard and the LCD screen will display as
below.
Simply Press the key ‘L’. After the command, the LCD screen will be display as
below.
Press `ENTER' key on the ASCII Keyboard and the LCD screen will display as
below.
Step 3
View the Set Break Point address using View Break Point `I' command illustrated in
(Keyboard Command section).
Step 4
Execute the program from 3000 location using Executing `G' command illustrated in
(Keyboard Command section).
After that, LCD screen will display as follows.
Step 4
Now you can examine all registers using Examine/Modify Register `R' command
illustrated in (Keyboard Command section).
Serial Command
M51-02 provides the following on-board Serial interfaces.
1. RS-232C interface through UART of the 8051 Micro controller chip.
2. AUX RS-232C interface through 8251 USART chip.
RS-232C Interface
The RS-232C interface provided by 8051 chip is a three line interface i.e. the
handshake lines are not provided. The three signals namely GND, TX & RX are
brought out at Connector CN7. Through this RS-232 interface user can communicate
with PC by selecting baudrate of 2400 bps.
The user can communicate 8051 Kit with PC as below procedure mentioned.
1. Connect Serial cable at CN8 of the Kit to any COM-1 OR COM-2 of the PC.
2. Run Windows Hyper Terminal Software using baudrate of 2400 bps.
3. Press `Y' key on M51-02 Kit ASCII keyboard & the LCD screen will display.
a. Press `Y' key on M51-02 Kit ASCII keyboard & the LCD screen will
display.
Uploading
Uploading the ABC.HEX from Trainer to Computer
The following procedure is to be adopted for uploading the file from Trainer to PC.
1. Type `UP’ on the PC Screen through PC keyboard
2. Write Start Address and End Address
3. Then Go in Menu bar. Select <Transfer> <Capture Text...> from PC keyboard
give any name with HEX Extension i. e. ABC.HEX (You can Browse where
you want to save it) Click on <Start>
4. Press ‘Enter’ Key of PC. Address and Data will seen on PC Screen.
5. Then again Go in Menu bar. Select <Transfer> <Capture Text> click on
<Stop>
6. Data captured will be stored in the file as defined by the file name.
Memory/IO Mapping
Memory Mapping :
The 8051 chip supports 64K bytes of program memory and 64K bytes of data
memory. Since in a practical situation, the user may need the same memory area for
Data as well as programs, the system M51-02 has been designed such a way that the
same memory chip can be used as program/data memory. There are three memory
sockets namely MEM0, MEM1 & M3M2.
MEM0 is defined as Program Memory which is used for Monitor Program. 16K
Bytes of Powerful Monitor Program is Embedded in the 27C512 EPROM. The
Program Memory address is from `0000 to 3FFF'.
MEM1 is defined as user Program Memory / Data Memory. 32K bytes of RAM
(62256) can be used for Program Memory / Data Memory for the user RAM. The
address is from `3000 to AFFF' for the user RAM.
MEM2 is defined as expenction for Program Memory / Data Memory. 16K bytes of
RAM can be used for Program Memory / Data Memory. The address is from `B000
to EFFF'.
I/O Mapping :
Various chips used in M51-02 are 8255, 8253, RTC ADC, DAC and 8251. The
addresses for these I/O devices are given below:
Active range Port Numbers Selected Device
Port Addresses
(FF00-FF03) 8255-I Programmable
Peripheral
Interface
FF00 Port A
FF01 Port B
FF02 Port C
FF03 Control Word
(FF04-FF07) 8255-II Programmable
Peripheral
Interface
FF04 Port A
FF05 Port B
FF06 Port C
FF07 Control Word
(FF0C-FF0F) 8253 Programmable
Interval Timer
FF0C Counter 0
FF0D Counter 1
FF0E Counter 2
FF0F Control Word
Subroutines
M51-02 Monitor uses certain subroutines for its operation, which can also be used by
the user of his programs. The addresses of these routines and their descriptions are
given here:
Address Label Description
1. 0AC1 RDADR: this routine reads address a has terminator, no other
register is destroyed
2. 16A5 CPRMPT: this routine displays prompt
TERM : on CRT no register is destroyed
3. 19D3 SERDISP: this routine displays message on the PC screen in
serial terminal emulation mode
Input : DPTR has message table address 24H
indicates end of message
4. 19DF TRNSM: this routine outputs the byte on RS-232C serial port
Input: accumulator has byte to be outputted no other
register affected.
5. 1A14 RECV this routine inputs character from serial port into
accumulator, no other register affected.
6. 1A6B TRANS this routine unpacks the hex byte into two hex
nibbles then transmits ASCII, equivalents of the two
one RS-232C serial port
Input: a has the hex byte no register is affected.
7. 0B77 GETCDE this routine searches the table
Input: a has byte to be searched in table, DPTR has
starting address of table on-chip ram location, 4E
has number enters in table
Output: a has position number of character in table
if found else carry is set indicating character not
found.
8. 1558 LCDINT this routine initialize LCD.
9. 1581 SWRITE this routine accepts data from accumulator and treat
it as command word for LCD.
10. 1591 WRITE this routine accepts data from accumulator and treat
it as data to be displayed on LCD.
11. 0AA1 GETKEY this routine wait for key to be pressed and put
corresponding ASCII codes in accumulator.
12. 0A3C DISPLAY this routine displays DPTR on ROW 1 of LCD
Sample Programs
Programs are given here to the user to understand the programming techniques of
8051 microcontrollers.
Program-1 :
Flashing Display of `WELCOME M51-02 KIT' On LCD Screen. executing this
program from address 3000H, “ WELCOME M51-02 KIT ” message flashes on the
display of the kit.
Address Code Label Mnemonic Operand Comments
3000 90 30 1E HERE: MOV DPTR,#301E WELCOME
M51-02 KIT message
3003 12 0A 3C LCALL 0A3C display routine
3006 7B 00 MOV R3,#0
3008 7A 00 LOOP2: MOV R2,#0
300A DA FE LOOP1: DJNZ R2,LOOP1 delay code
300C DB FA DJNZ R3,LOOP2
300E 90 30 32 MOV DPTR,#3032 blank message
3011 12 0A 3C LCALL 0A3C display routine
3014 7B 00 MOV R3,#0
3016 7A 00 LOOP4: MOV R2,#0
3018 DA FE LOOP3: DJNZ R2,LOOP3 delay code
301A DB FA DJNZL R3,LOOP4
301C 80 E2 SJMP 3000 Display message
`WELCOME M51-02
KIT
301E 57 45 4C 43 4F 4D DFB 57H, 45H, 4CH, 43H, 4FH, 4DH
3024 45 20 4D 35 31 2D DFB 45H, 20H, 4DH, 35H, 31H, 2DH
302A 30 32 20 4B 49 54 DFB 30H, 32H, 20H, 4BH, 49H, 54H to Blank
Display
3032 20 20 20 20 20 20 DFB 20H, 20H, 20H, 20H, 20H, 20H
3038 20 20 20 20 20 20 DFB 20H, 20H, 20H, 20H, 20H, 20H
303E 20 20 20 20 20 20 DFB 20H, 20H, 20H, 20H, 20H, 20H
Program-2:
Hexadecimal Addition of Two Numbers
On executing the program from 3000H enter the address message
displayed. Enter the first two digit operand then press enter, enter next two digit.
Operand. sum of two numbers is displayed if sum is greater than two digits.
Address Code Label Mnemonic Operand Comments
3000 12 0A C1 START: LCALL 0AC1H read 1 st operand
3003 A3 INC DPTR
3004 E0 MOVX A,@DPTR
3005 F5 0A MOV 0AH,A
3007 12 0A C1 LCALL 0AC1H read 2 nd operand
300A A3 INC DPTR
300B E0 MOVX A,@DPTR
300C 25 0A ADD A,0AH ADD Hex
300E 90 4E 00 MOV DPTR,#4E00H
3011 F0 MOVX @DPTR,A
3012 90 4E 00 MOV DPTR,#4E00H
3015 F0 MOVX @DPTR,A
3016 54 F0 ANL A,#0F0H
3018 C4 SWAP A
3019 90 4E 01 MOV DPTR,#4E01H
301C F0 MOVX @DPTR,A
301D 90 4E 00 MOV DPTR,#4E00H
3020 E0 MOVX A,@DPTR
3021 54 0F ANL A,#0FH
3023 90 4E 02 MOV DPTR,#4E02H
3026 F0 MOVX @DPTR,A
3027 12 15 58 LCALL 1558H display result
302A 90 4E 01 MOV DPTR,#4E01H
302D E0 MOVX A,@DPTR
302E 12 0B 77 LCALL 0B77H get code
3031 12 15 91 LCALL 1591H write
Program-5 :
This program is to see if the no. is odd or even. On executing program asks for word.
Enter the word and press `ENTER'. If the word odd `NUMBER IS ODD' display on
LCD screen. If word is even `NUMBER IS EVEN' will display on LCD screen.
Address Code Label Mnemonic Operand Comments
3000 12 0A C1 START: LCALL 0AC1H read operand
3003 A3 INC DPTR
3004 E0 MOVX A,@DPTR
3005 44 FE ORL A,#0FEH
3007 B4 FE 05 CJNE A,#0FEH,ODD
300A 90 30 2B MOV DPTR,#MSG2
300D 80 03 SJMP DISP
300F 90 30 17 ODD: MOV DPTR,#MSG1
3012 12 0A 3C DISP: LCALL 0A3CH display message
3015 80 FE HERE: SJMP HERE
3017 45 55 4D 42 MSG1: DFB 45H,55H,4DH,42H
301B 45 52 20 49 DFB 45H,52H,20H,49H
301F 53 20 4F 44 DFB 53H,20H,4FH,44H
3023 44 20 20 20 DFB 44H,20H,20H,20H
3027 20 20 20 20 DFB 20H,20H,20H,20H
302B 45 55 4D 42 MSG2: DFB 45H,55H,4DH,42H
302F 45 52 20 49 DFB 45H,52H,20H,49H
3033 53 20 45 56 DFB 53H,20H,45H,56H
3037 45 4E 20 20 DFB 45H,4EH,20H,20H
303B 20 20 20 20 DFB 20H,20H,20H,20H
Program-6 :
Hex multiplication.
Reads two hex bytes from keyboard multiplies them and displays result.
Address Code Label Mnemonic Operand Comments
3000 12 0A C1 START: LCALL 0AC1H read 1 st operand
3003 A3 INC DPTR
3004 E0 MOVX A,@DPTR
3005 F5 F0 MOV 0F0H,A
Program-8:
This program reads a key from the 101 ASCII keyboard of PC and split it into two
nibbles and stores MSB nibble in 3050H M.L. and LSB in 3051H M.L.
Address Code Label Mnemonic Operand Comments
3000 12 5A CF LCALL 5ACFH
3003 12 1A 14 LCALL 1A14H receive data
3006 FB MOV R3,A
3007 54 F0 ANL A,#F0
3009 C4 SWAP A
300A F8 MOV R0,A
300B EB MOV A,03
300C 54 0F ANL A,#0F
300E 90 30 50 MOV DPTR,#3050H
3011 F0 MOVX @ DPTR,A
3012 A3 INC DPTR
3013 E8 MOV A,00
3014 F0 MOVX @DPTR,A
3015 02 16 A5 LJMP 16A5H
Program-9:
This program displays a character on PC Screen when ASCII code is in accumulator.
Address Code Label Mnemonic Operand Comments
3000 12 5A CF MOV 5ACFH
3003 74 44 MOV A,#44
3005 12 19 DF LCALL 19DFH trnsm
3008 02 16 A5 LJMP 16A5H
Program-10 :
This program displays the no. in accumulator on PC Screen.
Address Code Label Mnemonic Operand Comments
3000 12 5A CF MOV 5ACFH
3003 74 44 MOV A,#44
3005 12 1A 6B LCALL 1A6BH trnsm
3008 02 16 A5 LJMP 16A5H
Connectors
The pin details of the various connectors are given here for your reference.
Bus Connector-CN1
Pin no. Signal Pin no. Signal
1 P1.0 21 P3.1/TXD
2 VCC 22 ALE
3 P1.1 23 P3.2/INT0
4 AD0 24 NC
5 P1.2 25 P3.3/INT1
6 AD1 26 P2.7/A15
7 P1.3 27 P3.4/T0
8 AD2 28 P2.6/A14
9 P1.4 29 P3.5/T1
10 AD3 30 P2.5/A13
11 P1.5 31 P3.6/WR
12 AD4 32 P2.4/A12
13 P1.6 33 P3.7/RD
14 AD5 34 P2.3/A11
15 P1.7 35 NC
16 AD6 36 P2.2/A10
17 RESET 37 NC
18 AD7 38 P2.1/A9
19 P3.0/RXD 39 GND
20 NC 40 P2.0/A8
Bus Connector-CN2
Pin Signal Pin Signal
1 A3 6 A5
2 A7 7 A0
3 A2 8 A4
4 A6 9 CS-IO
5 A1 10 RST
8253 Connector-CN5
Pin Signal Pin Signal
1 CLK-0 6 CLK-1
2 OUT-0 7 GATE-2
3 GATE-0 8 OUT-2
4 OUT-1 9 CLK-2
5 GATE-1 10 GND
8255-II Connector-CN4
Pin no. Signal Pin no. Signal
1 PC4 14 PB1
2 PC5 15 PA6
3 PC2 16 PA7
4 PC3 17 PA4
5 PC0 18 PA5
6 PC1 19 PA2
7 PB6 20 PA3
8 PB7 21 PA0
9 PB4 22 PA1
10 PB5 23 PC6
11 PB2 24 PC7
12 PB3 25 GND
13 PB0 26 VCC
8255-I Connector-CN3
Pin no. Signal Pin no. Signal
1 PC4 9 PB4
2 PC5 10 PB5
3 PC2 11 PB2
4 PC3 12 PB3
5 PC0 13 PB0
6 PC1 14 PB1
7 PB6 15 PA6
8 PB7 16 PA7
APPENDIX
Instructions That Affect Flag Settings
FLAG
Instruction
CY OV AC
ADD x x x
ADDC x x x
SUBB x x x
MUL 0 x
DIV 0 x
DA x
RRC x
RLC x
CJNE x
SETB C 1
CLR C 0
CPL C x
ANL C,bit x
ANL C,/bit x
ORL C,bit x
ORL C,/bit x
MOV C,bit x
8051 Instruction Set
Arithmetic Operations
Mnemonic Byte Cyc
ADD A,@Ri 1 1
ADD A,Rn 1 1
ADD A,direct 2 1
ADD A,#data 2 1
ADDC A,@Ri 1 1
ADDC A,Rn 1 1
Notes :
1. denotes the difference between 80C552 and 8051
2. + denotes the addition of 80C552
Warranty
1. We guarantee the product against all manufacturing defects for 12 months from
the date of sale by us or through our dealers. Consumables like dry cell etc. are
not covered under warranty.
2. The guarantee will become void, if
a) The product is not operated as per the instruction given in the operating
manual.
b) The agreed payment terms and other conditions of sale are not followed.
c) The customer resells the instrument to another party.
d) Any attempt is made to service and modify the instrument.
3 The non-working of the product is to be communicated to us immediately giving
full details of the complaints and defects noticed specifically mentioning the
type, serial number of the product and date of purchase etc.
4 The repair work will be carried out, provided the product is dispatched securely
packed and insured. The transportation charges shall be borne by the customer.