Introduction 89C51/8051 Microcontroller Kit of Vi Microsystems
-
Upload
assini-hussain -
Category
Documents
-
view
1.386 -
download
38
Transcript of Introduction 89C51/8051 Microcontroller Kit of Vi Microsystems
Expt. No.1 INTRODUCTION TO 8051 MICROCONTROLLER KITDate:
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 interface8051 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 CommandSyntax: #sp <Address> <Enter> : For program memory#sd <Address> <Enter> : For data memory
b) Register View/ Modify CommandSyntax: #r <Enter>
c) Execute CommandSyntax: #go <Address> <Enter>
d) Execute with break point commandSyntax: #go <Start address> <Space> <Enter>
e) Assembler commandSyntax: #a <Enter>
f) Disassembler commandSyntax: #u <Enter>
g) Internal RAM commandSyntax: #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
4000H
User Program Memory Combined with Data
Memory
BFFFH
0000H Monitor EPROM area 3FFFH
External Data Memory FF00H Memory Mapped IO FFFFHC000H User Data Memory FEFFH
4000H
User Data Memory Combined with Program
Memory
BFFFH
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)
FFC0HUsed for Add-on
Application BoardsFFFFH
FF24H Not Used FFBFH
FF23H Digital OutputFF22H Digital Input
FF20H Not Used FF21H
FF18H IBM Keyboard Select FF1FH
FF14H Not Used FF17H
FF0CHParallel Ports-I & II
(8255)FF13H
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 locations2. Display and modify the registers of the 80513. Enter and initiate execution of your own program4. Assemble and disassemble
Command line editor features:Single line editor can process up to 40 charactersValid key functions are:
EnterTo validate an entryTo increment memory locationTo select from memory
-To decrement memory locationsTo select from menu
.To terminate a command
Backspace
To delete a character and comeback one positionLeft arrow
To come back one position without deleting a characterRight arrow
To move right one position without deleting a characterSpace bar
To provide space in a command or dataDel
To delete a character in a command line0 to 9
Numeric character a-z
Alphabetic characterShift
Non-alphabetic and uppercase alphabetic character
Connector details:The connectors available in kit are:
1. Power Connector (P1)Single row 5 pin unicon Male connectorSignal description
Pin Details1 GND2 -12V3 +12V4 No connection5 Vcc (+5V)
2. CPU Bus Connector (U6)40 pin IDC male connector20 pins arranged in two rows
3. ADC & DAC Connector (P11 & P13)Screw type J801 Connector
Format for assembly language program:
ADDRESS LABEL
OPCODE &
OPERANDS
MNEMONICS COMMENTS
4100 MAIN 74 23 mov a,#23 Load accumulator by 23H
4102 24 22 add a,#22Add accumulator with 22H and store result in accumulator
4104 90 42 00 mov dptr,#4200 Load data pointer by external memory address 4200H
4107 F0 movx @dptr,aMove accumulator content to external memory location pointed by data pointer
4108 50 04 jnc LOOP1 If any carry in addition, go to loop1 else next address
410A 74 01 mov a,#01 Load accumulator by 1H410C 80 01 sjmp LOOP2 Go to loop2410E LOOP1 E4 clr a Clear accumulator
410F LOOP2 A3 inc dptr Increment data pointer by one
4110 F0 movx @dptr,aMove accumulator content to 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 memory4100 00-
Enter the opcode
Edit Program memory4100 00-74 <CR>
Enter 74H
Edit Program memory4101 00-22 <CR>
Enter 22H
Edit Program memory4102 00-. <CR>
After entering the program came back to command prompt by entering ‘.’
Micro-51#_
2. To enter/view data to data memoryThe 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 memory4400 00-
Enter the opcode
Edit Program memory4400 00-74 <CR>
Enter 74H
Edit Program memory4401 00-. <CR>
After entering the program came back to command prompt by entering ‘.’
Micro-51#_
3. To enter data/modify to 8051 registersThe procedure is as follows:
Micro-51#R
Enter register view/modify commandInitially register A is displayed
Register ViewA = 80 - _
Press enter or ‘-‘ key to subsequent or the previous registerChange the data to any register if desired and enterTo terminate enter ‘.’ And return command prompt
4. To view 8051 internal RAMMicro-51#ir 40
Enter internal RAM commandINTERNAL RAM VIEWADDRESS – 40 - 18
Enter to get command prompt
5. To enter assembly language program by assembler Micro-51#a <CR>
Enter assembler commandORIGIN :
Origin is displayedORIGIN : 4100 <CR>
Enter the origin of program4100
Address is displayed4100MOV A,#23 <CR>
Enter the instruction4100 74 23MOV A,#23
Assembler gives the opcode and displayed in the LCDEnter for next instruction
Enter ‘.’ For return to command prompt
6. To execute a programMicro-51#go 4100 <CR>
Go command followed by 16 bit address (Program memory) and enterIf 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 locations2. 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 RAM5. 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.
ADDRESS LABEL
OPCODE &
OPERANDS
MNEMONICS COMMENTS
4100 MAIN 78 11 mov r0,#11 r0 = data 14102 79 FF mov r1,#ff r1 = data 24104 E8 mov a,r0 A = r0 4105 29 add a,r1 A = A + r14106 FA mov r2,a R2 = A4107 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
ADDRESS LABEL
OPCODE &
OPERANDS
MNEMONICS COMMENTS
4100 MAIN 75 D0 08 mov psw,#08 PSW= 0000 1000 , Where RS1=0 and RS0=1 for bank 1
4103 79 FF mov r1,#ff R1=data 14105 7A 10 mov r2,#10 R2 =data 24107 E9 mov a,r1 A=R14108 9A subb a,r2 A = A – R24109 F8 mov r0,a R0=A410A HALT 80 FE sjmp HALT Halt the program
The observed result is:_____________
3. Program to check port 0. (Use Vi89C51 kit)
ADDRESS LABEL
OPCODE &
OPERANDS
MNEMONICS COMMENTS
4100 MAIN 90 FF 22 mov dptr,#ff22
DPTR=FF22H, IO mapping address of digital input switches connected to port 0
4103 E0 movx a,@dptrReading the Port 0 switches and A=[DPTR]
4104 A3 inc dptr
Increment DPTR to FF23H, IO mapping address of digital output LEDs connected to port 0
4105 23 rl a Rotate A to left
4106 F0 movx @dptr, aSend the status of 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