Sei sulla pagina 1di 20

Expt. No.

1 Date: Objective:

INTRODUCTION TO 8051 MICROCONTROLLER KIT 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)

C000H 4000H 0000H

External Program Memory EPROM Expansion area User Program Memory Combined with Data Memory Monitor EPROM area

FFFFH BFFFH 3FFFH

FF00H C000H 4000H 0000H

External Data Memory Memory Mapped IO User Data Memory User Data Memory Combined with Program Memory User Data Memory

FFFFH FEFFH BFFFH 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)

FFC0H FF24H FF23H FF22H FF20H FF18H FF14H FF0CH FF08H FF04H FF00H

Used for Add-on Application Boards Not Used Digital Output Digital Input Not Used IBM Keyboard Select Not Used Parallel Ports-I & II (8255) 174 Latch Select LCD Chip Select Not Used

FFFFH FFBFH

FF21H FF1FH FF17H FF13H FF0BH FF07H 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 1 2 3 4 5

Details GND -12V +12V No connection 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: ADDRES S 4100 4102 4104 4107 4108 410A 410C 410E 410F 4110 4111 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 STOP OPCODE & LABEL OPERAN DS MAIN 74 23 24 90 F0 50 74 80 E4 A3 F0 80 FE 04 01 01 22 42 00 MNEMO NICS mov a,#23 add a,#22 mov dptr,#4200 movx @dptr,a jnc LOOP1 mov a,#01 sjmp LOOP2 clr a inc dptr movx @dptr,a sjmp STOP

COMMENTS Load accumulator by 23H Add accumulator with 22H and store result in accumulator Load data pointer by external memory address 4200H Move accumulator content to external memory location pointed by data pointer If any carry in addition, go to loop1 else next address Load accumulator by 1H Go to loop2 Clear accumulator Increment data pointer by one Move accumulator content to external memory location pointed by data pointer Halt

LOOP1 LOOP2

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 00Enter 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 & ADDRESS LABEL OPERAN DS 4100 MAIN 90 FF

MNEMO NICS

COMMENTS DPTR=FF22H, IO mapping address of digital input switches connected to port 0 Reading the Port 0 switches and A=[DPTR] Increment DPTR to FF23H, IO mapping address of digital output LEDs connected to port 0 Rotate A to left Send the status of switches to LEDs connected to Port 0 Repeat the program

22

mov dptr,#ff22

4103

E0

movx a,@dptr

4104 4105 4106 4107

A3 23 F0 80 F8

inc dptr rl a movx @dptr, a sjmp MAIN

Observe the outputs when switch is pressed Results: Studied about 8051 microcontroller kit

Potrebbero piacerti anche