You are on page 1of 20

Expt. No.

1 INTRODUCTION TO 8051 MICROCONTROLLER KIT


Date:

Objective: To study the basics of 8051 Microcontroller Kit

Equipments Required:
Microcontroller Kit

Theory:
Specifications of the kit:
1. Hardware specifications:
• Intel 8051/89C51 at 12MHz
• Memory address
 System EPROM location : 0000H to 3FFFH
and C000H to FFFFH
 System RAM location : 4000H to BFFFH
 Additional RAM : 0000H to 3FFFH
and C000H to FEFFH (For Micro-51 LC Kit), 0000H to
3FFFH and C000H to FF00H (For Vi89C51 kit)
 Monitor Buffer : 4000H to 40FFH
 User Program/Data RAM location : 4100H to BFFFH
 User Data RAM location : 0000H to 3FFFH
and C000H to FEFFH (For Micro-51 LC Kit), 0000H to
3FFFH and C000H to FF00H (For Vi89C51 kit)
 Memory mapped IO : FF00H to FF2FH
and FFC0H to FFFFH
 Memory mapped IO expansion : FF20H to FFBFH

Monitor buffer should not be accessed by the user since it is used by the monitor
program.
• Input and Output
 24 IO lines using two Programmable Peripheral Interface
IC (8255)
 One RS232C Serial Interface using 8051 Serial port
 Two 16 bit timers
 One Centronics compatible Printer Interface through first
8255
 Five interrupt sources
• Display
 16x2 alpha numeric LCD display
 6 digit, 7 segment red LED display with filter
• IBM keyboard interface
8051 Trainer kit (Vi89C51 SB) Interface Block diagram (In left page of record)

2. Software specifications:
The Microcontroller Kit Micro-51 LC of Vi Microsystems contains a high
performance 32kB monitor program. It is designed to respond to user input,
RS232C serial communications, etc. Some simple commands (Not case sensitive)
for the kit are:

a) Substitute Memory Command


Syntax: #sp <Address> <Enter> : For program memory
#sd <Address> <Enter> : For data memory
b) Register View/ Modify Command
Syntax: #r <Enter>
c) Execute Command
Syntax: #go <Address> <Enter>
d) Execute with break point command
Syntax: #go <Start address> <Space> <Enter>
e) Assembler command
Syntax: #a <Enter>
f) Disassembler command
Syntax: #u <Enter>
g) Internal RAM command
Syntax: #ir <Address><Enter>

3. Memory configurations:
All peripherals in Micro-51 LC of Vi Microsystems are memory mapped,
ie the peripheral will also be included in the memory configuration.
Memory allocation table is shown in table 1: (In left page of the records)
External Program
Memory
C000H EPROM Expansion area FFFFH
User Program Memory BFFFH
Combined with Data
4000H Memory
0000H Monitor EPROM area 3FFFH
External Data Memory
FF00H Memory Mapped IO FFFFH
C000H User Data Memory FEFFH
User Data Memory BFFFH
Combined with Program
4000H Memory
0000H User Data Memory 3FFFH

Allocation of EPROM:
The kit has a standard EPROM configuration of 32kB using one 27256 (32k x 8
EPROM). The address for the monitor EPROM is 0000H to 3FFFH and C000H to
FFFFH.

Allocation of RAM:
The kit has 32kB of R/W Program/Data memory using one 61256 (32k x 8
DRAM). The address is from 4000H to BFFFH, out of which the first 256 locations are
used by monitor as its data buffer area. Hence user program area starts from 4100H
onwards.
The kit has one more 32kB of R/W Data memory using one 61256 and the
address is from 0000H to 3FFFH and C000H to FEFFH.

Allocation of Memory Mapped IO:


The peripherals available in Vi-89C51 are all memory mapped. The complete
memory mapped IO allocation table is shown in table 2: (In left page of the record)

Used for Add-on FFFFH


FFC0H Application Boards
FF24H Not Used FFBFH
FF23H Digital Output
FF22H Digital Input
FF20H Not Used FF21H
FF18H IBM Keyboard Select FF1FH
FF14H Not Used FF17H
Parallel Ports-I & II FF13H
FF0CH (8255)
FF08H 174 Latch Select FF0BH
FF04H LCD Chip Select FF07H
FF00H Not Used FF03H

Software features:
The kit accept any command related in the command prompt mode, indicated by a
‘#’ symbol in the leftmost position of the second row in the LCD module as shown below:

Micro-51
#_
Some functions that can be performed by the command are:
1. Display and substitute memory locations
2. Display and modify the registers of the 8051
3. Enter and initiate execution of your own program
4. Assemble and disassemble
Command line editor features:
Single line editor can process up to 40 characters
Valid key functions are:

Enter
To validate an entry
To increment memory location
To select from memory
-
To decrement memory locations
To select from menu
.
To terminate a command
Backsp
ace
To delete a character and comeback one position
Left arrow
To come back one position without deleting a character
Right arrow
To move right one position without deleting a character
Space bar
To provide space in a command or data
Del
To delete a character in a command line
0 to 9
Numeric character
a-z
Alphabetic character
Shift
Non-alphabetic and uppercase alphabetic character
Connector details:
The connectors available in kit are:
1. Power Connector (P1)
Single row 5 pin unicon Male connector
Signal description
Pin Details
1 GND
2 -12V
3 +12V
4 No connection
5 Vcc (+5V)

2. CPU Bus Connector (U6)


40 pin IDC male connector
20 pins arranged in two rows
3. ADC & DAC Connector (P11 & P13)
Screw type J801 Connector
Format for assembly language program:

OPCODE
ADDRES & MNEMO
LABEL COMMENTS
S OPERAN NICS
DS
4100 MAIN 74 23 mov a,#23 Load accumulator by 23H
Add accumulator with 22H
4102 24 22 add a,#22 and store result in
accumulator
Load data pointer by external
4104 90 42 00 mov dptr,#4200
memory address 4200H
Move accumulator content to
4107 F0 movx @dptr,a external memory location
pointed by data pointer
If any carry in addition, go to
4108 50 04 jnc LOOP1
loop1 else next address
410A 74 01 mov a,#01 Load accumulator by 1H
410C 80 01 sjmp LOOP2 Go to loop2
410E LOOP1 E4 clr a Clear accumulator
Increment data pointer by
410F LOOP2 A3 inc dptr
one
Move accumulator content to
4110 F0 movx @dptr,a external memory location
pointed by data pointer
4111 STOP 80 FE sjmp STOP Halt

Procedure:
1. To enter assembly language program by placing opcodes in the program
memory.
The procedure is as follows:

Micro-51
#SP 4100 <CR>
(CR- Carriage Return)
Enter substitute memory command with 16 bit address of the program memory
Edit Program memory
4100 00-
Enter the opcode
Edit Program memory
4100 00-74 <CR>
Enter 74H
Edit Program memory
4101 00-22 <CR>
Enter 22H
Edit Program memory
4102 00-. <CR>

After entering the program came back to command prompt by entering ‘.’

Micro-51
#_

2. To enter/view data to data memory


The procedure is as follows:

Micro-51
#SD 4400 <CR>
(CR- Carriage Return)
Enter substitute memory command with 16 bit address of the data memory
Edit Program memory
4400 00-

Enter the opcode


Edit Program memory
4400 00-74 <CR>
Enter 74H
Edit Program memory
4401 00-. <CR>
After entering the program came back to command prompt by entering ‘.’

Micro-51
#_
3. To enter data/modify to 8051 registers
The procedure is as follows:
Micro-51
#R

Enter register view/modify command


Initially register A is displayed
Register View
A = 80 - _
Press enter or ‘-‘ key to subsequent or the previous register
Change the data to any register if desired and enter
To terminate enter ‘.’ And return command prompt

4. To view 8051 internal RAM


Micro-51
#ir 40
Enter internal RAM command
INTERNAL RAM VIEW
ADDRESS – 40 - 18
Enter to get command prompt

5. To enter assembly language program by assembler


Micro-51
#a <CR>
Enter assembler command
ORIGIN :

Origin is displayed
ORIGIN : 4100 <CR>

Enter the origin of program


4100
Address is displayed
4100
MOV A,#23 <CR>
Enter the instruction
4100 74 23
MOV A,#23
Assembler gives the opcode and displayed in the LCD
Enter for next instruction
Enter ‘.’ For return to command prompt

6. To execute a program
Micro-51
#go 4100 <CR>
Go command followed by 16 bit address (Program memory) and enter
If the program has infinite loop or halt, the following message will appear
Executing…

To exit from execution and to return control to the command editor, press RESET key in
the kit.

Error conditions:
1. Attempting to modify the contents of ROM or non-existing memory locations
2. Invalid address (ie not within the range of 0000H to FFFFH)
3. Invalid data (ie not within the range of 00H to FFH)
4. Attempting to modify the contents of internal RAM
5. Invalid address of internal RAM (ie not within the range 0000H to 007FH)
Demo programs to do in the lab:
1. Program to add two 8-bit data in R0 and R1 of bank0 and store the result to R2 in the
same bank.
OPCODE
ADDRES & MNEMO
LABEL COMMENTS
S OPERAN NICS
DS
4100 MAIN 78 11 mov r0,#11 r0 = data 1
4102 79 FF mov r1,#ff r1 = data 2
4104 E8 mov a,r0 A = r0
4105 29 add a,r1 A = A + r1
4106 FA mov r2,a R2 = A
4107 HALT 80 FE sjmp HALT Halt the program

The observed result is:


_____________
2. Program to subtract two 8 bit data in R1 and R2 of bank1 and store the result to R0 of
bank1
OPCODE
ADDRES & MNEMO
LABEL COMMENTS
S OPERAN NICS
DS
PSW= 0000 1000 , Where
4100 MAIN 75 D0 08 mov psw,#08
RS1=0 and RS0=1 for bank 1
4103 79 FF mov r1,#ff R1=data 1
4105 7A 10 mov r2,#10 R2 =data 2
4107 E9 mov a,r1 A=R1
4108 9A subb a,r2 A = A – R2
4109 F8 mov r0,a R0=A
410A HALT 80 FE sjmp HALT Halt the program

The observed result is:


_____________
3. Program to check port 0.
(Use Vi89C51 kit)
OPCODE
& MNEMO
ADDRESS LABEL COMMENTS
OPERAN NICS
DS
DPTR=FF22H, IO
mapping address of
4100 MAIN 90 FF 22 mov dptr,#ff22 digital input
switches connected
to port 0
Reading the Port 0
4103 E0 movx a,@dptr switches and
A=[DPTR]
Increment DPTR to
FF23H, IO mapping
4104 A3 inc dptr address of digital
output LEDs
connected to port 0
4105 23 rl a Rotate A to left
Send the status of
4106 F0 movx @dptr, a switches to LEDs
connected to Port 0
4107 80 F8 sjmp MAIN Repeat the program

Observe the outputs when switch is pressed

Results:
Studied about 8051 microcontroller kit

You might also like