You are on page 1of 84

1.

FAMILIARIZATION OF MICROPROCESSOR KIT


AIM To study the Microprocessor kit MICRO-85 EBI Technical Reference. HARDWARE SPECIFICATIONS 1.PROCESSOR CLOCK FREQUENCY: Intel 8085A at 6.144 MHz Clock 2.MEMORY: Monitor EPROM EPROM-Expansion System RAM Monitor Data Area RAM-Expansion :0000-1FFF :2000-3FFF &1000-FFFF :40000-5FFF :4100-5FFF :6000-BFFF

Note:The RAM area from 4000-40FF should not br accessed by the user since it is used as Scratch pad by the monitor program. 3.INPUT/OUTPUT: Parallel: 48 TTL I/O lines using two numbers of 8255 (Only 24 I/O line available in MICRO-86 EBI) Seial: One number of RS 232C compatible Serial Interfaces using 8251A USART. Timer: Three Channel 16 bit programmable Timer using 8253. Channel 0 is used as Baud rate clock generator for 8251A USART. Channel 1 is used for Single Stepping User Programs. Channel 2 is used for Hardware Single Stepping User Programs. 4.DISPLAY: 6 Digit, 0.3,7- Segment Red LED Display with Filter. 4 Digits for Address display and 2 Digits for Data Display.

5.KEYBOARD: 21 keys soft keyboard including command keys and hexadecimal keys. 6.AUDIO CASSETTE INTERFACE WITH FILE MANAGEMENT 7 BATTERY BACKUP: Onboard backup facility is provided for the available RAM. 8.HARDWARE SINGLE STEP: This facility allow the user to execute programs at machine cycle level using a separate switch 9.POWER SUPPLY SPECIFICATIONS:

Micro-85EB2 I/P: O/P: 230V ac @ 50 Hz +5V @ 3A +12V @ 250mA -12V @250 mA +30V @250 mA(Unregulated) 10.SYSTE POWER CONSUPTION:

Micro-85EB1 230V ac @50Hz +5V @600 nA

Micro-85EB2 +5V @1A +12V @200nA -12V @ 100nA 11.PHYSICAL CHARACTERISTICS: Micro-85EB PCB : 230mm X 120mm

Micro-85EB1 +5V @ 500mA

Weight : 1Kg 12.BUS EXPANSION: A VXT Bus has been incorporated in Micro-85EB which facilitates to patch upto any extra hardware to Micro-85EB. All address, data and control signals are brought out to this bus using VXT Bus.All VBMB boards can be interfaced with Micro 85EB. 13.TEST POINTS: Test points are provided for MR*,MW*,INTA*,IO/M*,IOR*,IOW*,SO,SI,INTA. This enables the user to study the hardware timing easily. SOFTWARE SPECIFICATIONS Micro-85EB contains a high performance 8KB monitor program. It is designed to respond to user input,RS232C serial communications, tape interface etc. The following is a simple description of the key function. Out of the 21 Keys in the keyboard, 16 are hexadecimal, command and register keys and the remaining are standalone keys.

KEY

FUNCTION SUMMARY

RES

This RES key allows you to terminate any present activity and to return your Micro-85EB.

Maskable interrupt connected to CPU RST 7.5 Interrupt. INT

Decrement the address by one and display the contents. DEC

EXEC

Execute a particular program after selecting the address through a command.

Increment address by one and display the next register contents. NEXT

The 16 hexadecimal keys have either a dual or triple role to play. 1. It functions as a hex key entry when data entry is required. 2. It functions as the register key entry during register command. 3. It functions as command key when pressed directly after command prompt. Note: The hex key function summary below is in the order.

1.Hex key KEY

2.Command key

3.Register key FUNCTION SUMMARY

0 SUB

1. Hex key entry O 2. This key is for substituting memory contents. When NEXT key is pressed immediately after this, it takes the user to the start address. 3. Register key E.

1 REG

1. Hex key entry 1 2. Examine the 8085A register & modify the same. 3. Register key D.

2 TW

1. Hex key entry 2 2. Write data from memory on to audiotape.. 3. Register key C.

3 TR

1.

Hex key entry 3

2. Receive data from an audio to memory. 3. Register key B.

4 BLOC

1. Hex key entry 4 2. Block search for a byte. 3. Register key F.

5 FILL

1. Hex key entry 5

2. Fill a block of RAM memory with desired data. 3. Register key A.

6 SER

1. Hex key entry 6 2. Transmit /receive data to/fro the serial port. The TW/TR keys are used for sending or receiving respectively. 3. Register key L.

7 F2

1. Hex key entry 7 2. Register key H.

8 GO

1. Hex key entry 8 2. Start running a particular program. 3. Register key I.

9 SNG

1. Hex key entry 9 2. Single step a program instruction by instruction. 2. Register key PCL.

A F3

1. Hex key entry A

2. Function key F3 F3[0] = input a byte from the port. F3[0] = output a byte to the port.

B BC

1.

Hex key entry B

2. Check a particular block for blank. 3. Register key SPL.

C MOV

1.

Hex key entry C

2. Move block of memory to another block. 3. Register key SPH.

1.

Hex key entry D

2. Compare two memory blocks.

1.

Hex key entry E

2. Insert bytes in to memory.

1. Hex key entry F

2. Delete bytes from memory.

RESULT: Familiarized p 85EB1 microprocessor kit with features such as 24 TTL lines using 8255 hardware single stepping of user program.

EXP.NO:2

8 BIT ARITHEMATIC
AIM: TO WRITE A PROGRAM IN ASSEMBLY LANGUAGE TO DO THE FOLLOWING OPERATIONS ON 8-BIT NUMBERS. (1) ADDITION (2) SUBTRACTION (3) MULTIPLICATION (4) DIVISION (1) ADDITION ALGORITHM:

1. Start.

2. Move 00 to register C. 3. Load the contents of 4200 to A. 4. Move the contents of A to B. 5. Load the contents of 4201 to A. 6. Add A and B and store it in A. 7. If no carry, jump to step 9 otherwise next step. 8. Increment C. 9. Store the contents of A to 4202. 10. Move the contents of C to A. 11. Store the contents of A to 4203. 12. Stop.

PROGRAM: LABEL ADDRES S 4100 MNEMONICS LDA 4200 HEXCODE 3A COMMENTS Load the Accumulator with the contents of 4200H

4101 4102 4103 MOV B,A

00 42 47 Contents of Accumulator moved

to B 4104 LDA 4201 3A Load Accumulator with the content of 4201H

4105 4106 4107 4108 4109 410A 410B 410C 410D LOOP 410E 410F 4110 4111 4112 4113 MOV A,C STA 4203 INR C STA 4202 ADD B JNC LOOP MVI C,00

01 42 0E 00 80 D2 0E 41 0C 32 02 42 79 32 03 Contents of moved to A Store 4203H carry C in If CY=1 increment C Register Store sum in 4202H Get the sum in Accumulator If CY =0 go to loop Clear C Register to count for carry

4114 4115 OBSERVATION ADDRESS 4200 4201 4202 4303 DATA 02 03 05 00 HLT

42 76 Stop execution

INPUT/OUTPUT INPUT INPUT OUTPUT OUTPUT

(2) SUBTRACTION ALGORITHM: 1. 2. 3. 4. 5. 6. 7. Start Load address of data in HL pair Get the first data in A Register Increment HL pair Subtract second data from first data Increment HL pair and store result in memory Stop

PROGRAM: LABEL ADDRES S 4100 MNEMONICS LXI H,4200 HEXCOD E 21 COMMENTS Load HL Register

with starting address of data 4101 4102 4103 4104 4105 4106 4107 MOV A,M INX H SUB M INX H MOV M,A 00 42 7E 23 96 23 77 Bring the data in to a Register Point to next location Subtract the second data Point to next location Transfer the result in to memory location Stop execution

4108

HLT

76

OBSERVATION

ADDRESS 4200 4201 4202

DATA 04 02 02

INPUT/OUTPUT INPUT INPUT OUTPUT

(4) MULTILPICATION ALGORITHM: 1. Move 00 to DD 2. Load the content of 4200 to A 3. Move the content of A to D 4. Load the content of 4201 to A 5. Move the content of A to B 6. Clear Content of A 7.Add the contents of A and D and store in A 8. If there is no carry jump to step 10 else to step 9 9. Increment C 10. PROGRAM: LABEL ADDRE SS 4100 4101 4102 LDA 4200 MNEMONICS MVI C.00 HEXCOD E 0E 00 3A Load the content of memory location 4200H to Accumulator Clear C COMMENTS

4103

00

4104 4105 4106 MOV D,A LDA 4201

42 57 3A Copy the data A to D Load the content of memory location 4201H to Accumulator

4107 4108 4109 410A LABEL 1 410B 410C 410D 410E 410F LABEL 2 4110 4111 4112 4113 4114 STA 4202 INR C DCR B JNZ LABEL 1 C2 MOV B,A XRA A ADD D JNC LABEL2

01 42 47 AF 82 D2 10 41 0C 05 Increment C Decrement B Jump to LABEL 1 if not zero 0B 41 32 Store the content of Accumulator to memory lacation 4202 Copy the data to B XOR A to A Add A and D ,and store the result to A Jump to LABEL 2 if no carry

4115

02

4116 4117 4118 MOV A,C STA 4203

42 79 32 Copy the data from C to A Store the content of Accumulator to memory location 4203

4119 411A 411B HLT

03 42 76 Stop

OBSERVATION ADDRESS 4200 4201 4202 DATA 04 02 08 INPUT/OUTPUT INPUT INPUT OUTPUT

(3) DIVISION ALGORITHM: PROGRM: LABEL ADDRES S 4100 4101 MNEMONICS MVI D,00 HEXCODE 16 00 COMMENTS Clear D Register

4102

LDA 4200

3A

Move the content of 4200H to Accumulator

4103 4104 4105 4106 4107 4108 LABEL 1 4109 SUB B MOV B,A LDA 4201

00 42 47 3A 01 42 90 Subtract A from B and store the result in A Increment D If no carry ,jump to LABEL 1 Move A to B Move the content of 4201H to A

410A 410B 410C 410D 410E 410F

INR D JNC LABEL 1

14 D2 09 41

DCR D ADD B

15 80

Decrement D Add A and B and store the result in Accumulator Store the content of Accumulator in 4202H

4110

STA 4202

32

4111 4112 4113 MOV A,D

02 42 7A Move the content of D Register to Accumulator Store the content of Accumulator in 4203H

4114

STA 4203

32

4115 4116 4117 HLT Stop

OBSERVATION

ADDRESS 4200 4201 4202 4203

DATA 04 02 02 00

INPUT/OUTPUT INPUT INPUT OUTPUT OUTPUT

RESULT: PROGRAMS FOR 8-BIT ARITHMETIC OPERATIONS WERE DONE AND OUTPUT IS VERIFIED

EXP.NO:3

SUM OF N NUMBERS
ALGORITHM PROGRAM: LABEL ADDRE SS 4100 4101 4102 4103 4104 4105 4106 4107 LOOP2 4108 4109 MOV B,A MOV C,A DCR C DCR B ADD B LDA 4200H MNEMONICS MVI D,00H HEXCOD E 16 00 3A 00 42 47 4F 0D 05 80 MOVE A TO B MOVE A TO C DECREMENT C REG DECREMENT B REG ADD THE CONTENT OF B REG WITH ACCUMULATOR LOAD ACCUMULATOR WITH THE CONTENT OF 4200 COMMENTS CLEAR DE PAIR

410A 410B 410C 410D LOOP1 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119

JNC LOOP1

D2 0E 41

IF NO CARRY JUMP TO LOOP1

INR D DCR C JNZ LOOP2

14 0D C2 08 41

INCREMENT D REG DECREMENT C REG IF NOT ZERO JUMP TO LOOP2

STA 4201

32 01 42

STORE CONTENT OF ACCUMULATOR TO 4201

MOV A,D STA 4202

7A 32

MOVE D TO A STORE CONTENT OF ACCUMULATOR TO 4202

HLT

76

STOP

OBSERVATION

ADDRESS 4200 4201 4202

DATA 05 0F 00

INPUT/OUTPUT INPUT OUTPUT OUTPUT

EXP.NO:4

MULTIBYTE ADDITION
AIM: TO WRITE A PROGRAM IN ASSEMBLY LANGUAGE TO PERORM MULTIBYTE ADDITION . ALGORITHM: 1.START 2.SET THE NUMBER OF BYTES AND SET THE BYTE COUNTER 3.SET ADDRESSES POINTERS TO BOTH NUMBERS 4.ADD A PAIR OF CORRESPONDING BYTE 5.STORE THE INTERMEDIATE RESULT 6.INCREMENT ADDRESS POINTERS

7.DECREMENT BYTE COUNTER 8.IF BYTE COUNT =0,STORE CARRY IN MEMORY,IF NOT THEN GO TO STEP 4 9.STOP PROGRAM: LABEL ADDRES S 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 LOOP1 410A 410B STC CMC LDAX D ADC M MOV B,M INX H LXID 4220 MNEMONICS LXI H,4210 HEXCOD E 21 10 42 46 23 11 20 42 37 3F 1A 8E Set Carry Clear Carry flag Load Accumulator with the content of DE pair Add the content pointed by the HL pair with the Carry Move the content of 4210H to B Register Point to first database Load the address 4220H to DE pair COMMENTS Load address 4210H to HL pair

410C 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117

MOV A,M INX D INX H DEC B JNZ LOOP1

7E 13 23 09 C2 0A 41

Move M to A Increment DE pair Increment HL pair Decrement B Register If the content of B Register is not zero repeat addition

MVI A,#00

3E 00

Make Accumulator 0

RAL MOV M,A HLT

17 77 76

Carry is brought to bit 1 Transfer the content of A to M Stop execution

OBSERVATION

ADDRESS 4210 4211 4212

DATA 02 02 04

INPUT/OUTPUT INPUT INPUT INPUT

4220 4221 4211 4212

04 02 06 06

INPUT INPUT OUTPUT OUTPUT

RESULT: A PROGRAM TO PERFORM MULTIBYTE ADDITION IS EXECUTED AND OUTPUT IS OBTAINED. EXP.NO:5

SORTING(ASCENDING ORDER)
AIM: TO WRITE A PROGRAM IN ASSEMBLY LANGUAGE TO PERORM THE SORTING OF N NUMBERS. ALGORITHM: 1.START 2.LOAD CONTENT OF 4200 TO A 3.MOVE A TO B. 4.DECREMENT B. 5.MOVE B TO C. 6.MOVE 4201 TO HL. 7.MOVE M TO A. 8.INCREMENT HL . 9. MOVE M TO D. 10.COMPARE A & M.

11.JUMP TO STEP 16 IF THERE IS CARRY. 12.MOVE A TO M. 13. DECREMENT HL. 14.MOVE D TO M. 15.INCREMENT HL. 16 DECREMENT C. 17. JUMP TO STEP 7 IF NOT ZERO. 18. DECREMENT B. 19.JUMP TO STEP 5 IF NOT ZERO. 20.STOP. PROGRAM: LABEL ADDRE SS 4100 4101 4102 4103 4104 LABEL3 4105 4106 MOV B,A DCR B MOV C,B LXI H,4201 MNEMONICS LDA 4200 HEXCOD E 3A 00 42 47 05 48 21 Move A to B Decrement B Move B to C Load 4201 to HL pair COMMENTS Load Accumulator with the content of 4200H

4107 4108 LABEL2 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 LABEL1 4114 4115 4116 4117 4118 4119 411A DCR B JNZ LABEL3 MOV M,A DCX H MOV M,D INX H DCR C JNZ LABEL2 MOV A,M INX H MOV D,M CMP M JC LABEL1

01 42 7E 23 56 BE DA 14 41 77 2B Move A to [HL] Decrement HL Move D to M 23 DD C2 09 41 05 C2 05 Decrement B Jump if not Zero to LABEL3 Increment HL Decrement C Jump if not Zero to LABEL2 Move M to A Increment HL pair Move M to D Compare A and [HL] Jump if carry to LABEL1

411B 411C HLT

41 76 Stop

OBSERVATION NUMBERS BEFORE SORTING ADDRESS 4200 4201 4202 4203 4204 4205 DATA 05 04 02 09 08 0A INPUT/OUTPUT INPUT INPUT INPUT INPUT INPUT INPUT

NUMBERS AFTER SORTING ADDRESS 4201 4202 4203 DATA 02 04 08 INPUT/OUTPUT OUTPUT OUTPUT OUTPUT

4204 4205

09 0A

OUTPUT OUTPUT

RESULT: A PROGRAM FOR SORTING OF N NUMBERS IN ASCENDING ORDER IS EXECUTED AND OUTPUT IS OBTAINED.

EXP.NO:6

REVERSAL OF A 16 BIT NUMBER


PROGRAM: LABEL ADDRE SS 4100 4101 4102 4103 4104 4105 4106 RRC RRC RRC RRC MNEMONICS LDA 4200 HEXCOD E 3A 00 42 0F 0F 0F 0F ROTATE A RIGHT THROUGH CARRY ROTATE A RIGHT THROUGH CARRY ROTATE A RIGHT THROUGH CARRY ROTATE A RIGHT THROUGH COMMENTS LOAD CONTENT OF 4200 TO ACCUMULATOR

CARRY 4107 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 4114 HLT RRC RRC RRC RRC STA 4202 32 02 42 76 STOP LDA 4201 STA 4203 32 03 42 3A 01 42 0F 0F 0F 0F ROTATE A RIGHT THROUGH CARRY ROTATE A RIGHT THROUGH CARRY ROTATE A RIGHT THROUGH CARRY ROTATE A RIGHT THROUGH CARRY STORE CONTENT OF ACCUMULATOR IN 4202 LOAD ACCUMULATOR WITH THE CONTENT OF 4201 STORE THE CONTENT ACCUMULATOR TO 4203

OBSERVATION

ADDRESS 4200 4201 4202 4203

DATA 01 EF FE 10

INPUT/OUTPUT INPUT INPUT OUTPUT OUTPUT

EXP.NO:7

SQUARE ROOT OF A NUMBER

PROGRAM: LABEL ADDRE SS 4100 4101 4102 4103 4104 4105 MVI B,01 MVI C,01 MNEMONICS LDA 4200 HEXCOD E 3A 00 42 0E 01 06 MOVE 01 TO B REGISTER MOVE 01 TO C REGISTER COMMENTS LOAD ACCUMULATOR WITH CONTENT OF 4200

4106 4107 LOOP 4108 4109 410A 410B 410C 410D 410E 410F 4110 4111 4112 4113 HLT MOV A,B STA 4201 DCR A INR C INR C INR B SUB C JNZ LOOP

00 3D 0C 0C 04 91 C2 D8 41 78 32 01 42 76 STOP MOVE B TO A STORE THE CONTENT OF ACCUMULATOR IN 4201 DECREMENT A REGISTER INCREMENT C REGISTER INCREMENT C REGISTER INCREMENT B SUBTRACT C FROM A JUMP IF NOT ZERO TO LOOP

OBSERVATION ADDRESS 4200 4201 DATA 09 020 INPUT/OUTPUT INPUT INPUT

EXP.NO:8

SQUARE OF A NUMBER
PROGRAM: LABEL ADDRE SS 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C MNEMONICS HEXCOD E COMMENTS

410D 410E 410F 4110 4111 4112 4113

OBSERVATION ADDRESS 4200 4201 DATA 09 020 INPUT/OUTPUT INPUT INPUT

EXP.NO:9

FACTORIAL OF A NUMBER
AIM:TO WRITE APROGRAM TO FIND FACTORIAL OF A GIVEN NUMBER ALGORITHM 1.START 2.INITIALIZE HL REGISTER WITH 0000H,E REGISTER WITH 05H AND D REGISTER WITH 00H 3.COPY THE CONTENT OF E REGISTER TO B REGISTER AND DECREMENT THE B REGISTER 4.COPY THE CONTENT OF B REGISTER TO C REGISTER 5.ADD THE CONTENT OF ACCUMULATOR AND D REGISTERS 6.DECREMENT THE B REGISTER AND IF IT IS NOT EQUAL TO ZERO GO TO STEP 5 ELSE GO TO STEP 7 7.EXCHANGE THE CONTENTS OF HL WITH DE REGISTERS 8.INITIALIZE HL REGISTER WITH 0000H 9.COPY THE CONTENT OF C REGISTER TO B REGISTER 10.DECREMENT THE B REGISTER AND IF IT IS NOT EQUAL TO ZERO GO TO STEP 4 ELSE GO TO STEP 11 11.MOVE THE CONTENT OF D REGISTER TO ACCUMULATOR 12.STOP THE RESULT TO DESIRED MEMORY LOCATION 13.STOP

PROGRAM:

LABEL

ADDRE SS 4100 4101 4102 4103 4104 4105 4106 4107 4108

MNEMONICS LXI H,0000H

HEXCOD E 21 00 00

COMMENTS CLEAR HL PAIR

MVI E,05

1E 05

INITIALIZE E REGISTER WITH 05

MVI D,00

16 00

CLEAR D REGISTER

MOV B,E DCR B MOV C,B DAD D DCR B JNZ AGAIN

43 05 48 19 05 C2

MOVE THE CONTENT OF E REGISTER TO B REGISTER DECREMENT B REGISTER MOV THE CONTENT OF B REGISTER TO C REGISTER A=A+D DECREMENT THE B REGISTER JUMP TO 410A IF ZERO BIT

START AGAIN

4109 410A 410B 410C

IS NOT SET 410D 410E 410F 4110 4111 4112 4113 4114 4115 4116 4117 4118 MOV A,D MOV B,C DCR B JNZ START 00 41 05 C2 09 41 7A MOVE THE CONTENT OF D REGISTER TO ACCUMULATOR STORE THE CONTENT OF ACCUMULATOR TO 4200 MOVE THE CONTENT OF C REGISTER TO B REGISTER DECREMENT THE B REGISTER JUMP TO 4109 IF ZERO BIT IS NOT SET XCHG LXI H,0000H 0A 41 EB 21 00 EXCHANGE THE CONTENT OF HL WITH DE CLEAR HL PAIR

4119 411A 411B 411C

STA 4200

32 00 42

MOV A,E

7B

MOVE THE CONTENT OF E

REGISTER TO ACCUMULATOR 411D 411E 411F 4120 HLT STA 4201 32 01 42 76 END PROGRAM STORE THE CONTENT OF ACCUMULATOR TO 4201

OBSERVATION ADDRESS 4104 4200 4201 DATA 05 00 78 INPUT/OUTPUT INPUT OUTPUT OUTPUT

EXP.NO:9

CODE CONVERSION
AIM: TO WRITE A PROGRAM IN ASSEMBLY LANGUAGE TO PERORM (a)DECIMAL TO ASCII (b)HEXADECIMAL TO DECIMAL (c)HEXADECIMAL TO BCD (d)ASCII TO HEXADECIMAL (a)DECIMAL TO ASCII ALGORITHM: 1.START 2.LOAD ACCUMULATOR WITH CONTENTS OF 4200 3.COMPARE IMMEDIATE DATA OA WITH ACCUMULATOR 4.IF NO CARRY THEN GO TO STEP 7 5.ADD IMMEDIATE DATA 30 TO ACCUMULATOR 6.JUMP TO STEP 8 7.INITIALIZE A WITH EE 8.STORE CONTENTS OF ACCUMULATOR TO THE MEMORY 9.STOP

PROGRAM:

LABEL

ADDRES S 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C

MNEMONICS LDA 4200

HEXCOD E 3A 00 42

COMMENTS Move the content of 4200 to Accumulator

CPI 0A MVI D,00 JNC LABEL1

FE 0A D2 0D 41

Compare 0A with A Clear D Register Jump if no carry to LABEL1

ADI 30

C6 30

Add 30 to A

JMP LABEL2

C3 0F 41

Jump to LABEL2

LABEL1

410D 410E

MVI A,EE JNC LABEL2 STA 4201

3E D2 32 01 42

Move EE to A Jump if no carry to LABEL2 Store the content of Accumulator to 4201H

LABEL2

410F 4110 4111

4112

HLT

76

Stop

OBSERVATION DATA ADDRESS 4200 4201 08 38 INPUT OUTPUT INPUT/OUTPUT

(b)HEXADECIMAL TO DECIMAL

ALGORITHM: 1.START 2.LOAD ACCUMULATOR WITH CONTENTS OF 4200 3.INITIALIZE BS REGISTER PAIR WITH 0000 4.SUBTRACT IMMEDIATE DATA 64H FROM A 5.IF CARRY JUMP TO STEP 4 6.INCREMENT B 7.JUMP TO STEP 4 8.ADD IMMEDIATE DATA 64H WITH A 9.SUBTRACT IMMEDIATE DATA 0A WITH ACCUMULATOR

10.IF CARRY JUMP TO STEP 13 11.INCREMENT C 12.JUMP TO STEP 9 13.ADD IMMEDIATE DATA 0A WITH ACCUMULATOR 14.MOVE CONTENTS OF A TO D REGISTER 15.MOVE CONTENT OF B REGISTER TO ACCUMULATOR 16.STORE CONTENT OF ACCUMULATOR TO MEMORY 17.ROTATE A BIT LEFT FOUR TIMES 18.ADD ACCUMULATOR CONTENTS TO D REGISTER CONTENT 19.STORE THE CONTENTS OF ACCUMULATOR TO MEMORY 20.STOP

PROGRAM: LABEL ADDRES S 4100 4101 4102 4103 4104 LXI B,0000 MNEMONICS LDA 4200 HEXCOD E 3A 00 42 01 00 Clear BC Register pair COMMENTS Move the content of 4200 to Accumulator

4105 LABEL2 4106 4107 4108 4109 410A 410B 410C 410D 410E LABEL1 410F 4110 LABEL4 4111 4112 4113 4114 4115 4116 4117 4118 INR C JMP LABEL4 JC LABEL3 SUI 0A ADI 64 INR D JMP LABEL2 JC LABEL1 SUI 64

00 D6 64 DA 0F 41 C6 C3 06 41 C6 64 D6 0A DA 1A 41 0C C3 11 Increment C Jump to LABEL4 Jump if carry to LABEL3 Subtract 0A from 64 Add 64 to A Increment D Jump to LABEL2 Jump if carry to LABEL1 Subtract 64 from A

4119 LABEL3 411A 411B 411C 411D 411E 411F 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 412A HLT MOV A,C RLC RLC RLC RLC ADD D STA 4202 MOV D,A MOV A,B STA 4201 ADI 0A

41 C6 0A 57 18 32 01 42 79 07 07 07 07 82 32 02 42 76 Stop Move C to A Rotate left one bit Rotate left one bit Rotate left one bit Rotate left one bit Add A and D and store result in A Store the content of Accumulator in 4202H Move A to D Move B to A Store content of Accumulator in 4201H Add 0A to A

OBSERVATION DATA ADDRESS 4200 4201 0A 10 INPUT OUTPUT INPUT/OUTPUT

RESULT: THE PROGRAM FOR CONVERTNG (1)DECIMAL TO ASCII AND (2)HEXADECIMAL TO DECIMAL IS DONE , EXECUTED AND OUTPUT IS VERIFIED. (c)HEXADECIMAL TO BCD ALGORITHM: PROGRAM: LABEL ADDRES S MNEMONICS HEXCOD E COMMENTS

OBSERVATION DATA ADDRESS INPUT/OUTPUT

(d)ASCII TO HEXADECIMAL ALGORITHM:

PROGRAM: LABEL ADDRES S MNEMONICS HEXCOD E COMMENTS

OBSERVATION DATA ADDRESS INPUT/OUTPUT

CYCLE 2
EXP.NO:11

FAMILIARIZATION OF MICROCONTROLLER (8051) KIT


AIM: TO FAMILIARIZE AND STUDY THE MICRO CONTROLLER KIT. INTODUCTION: The hardware of Micro-51 EB explained here highlights on each and every technical aspects concerned with memory and peripheral interfacing. FUNCTIONAL BLOCK DESCRIPTION 1) Input and Output of the CPU

The CPU gets the clock from the clock generation logic. The reset, Interrupt lines and data lines are input to the CPU. The CPU outputs comprise the address lines, data lines and control lines. 2) Address and Data Bus IN 8051,89C51 port 09 is low order multiuplerxed address and data bus.port 2 emit s the higher order address byte during access to external program and data memory.the multiplexed address/data lines are brought to address latch and data transceivers.the higher order lines are brought to address latches.the output of address latch and transceiver comprise the 16 bit address bus[A0A15] and 8 bit data bus [D0-D7] respectively. 3) Control bus

The other bus is the control bus.The control signals required for proper operation of the system are the I/O read,I/O write,memory read and memory write signals. The peripherals on the trainer are all memory mapped utilizing the memory address from FF00 to FFFF.Hence IOR and IOW will select for address from FF00 to FFFF.The MR signals are utilized to read or write the memory devices namely EPROM and RAM. 4) Memory It consists of 32kb EPROM and 64kb RAM.The external program memory and data memory of 8051 are combined in micro-51EB with the help of appropriate circuitry at the address of 4000-bfff ONLY Allocation of RAM The mocro-51EB has32kb of read/write program/data memory.Using one 61256 whose address is from 4000 to BFFF out of which the first 100 locations are used by the monitor asits data buffer area.Hence user program area starts from 4100. The micro-51ER has one more 32Kbytes of Read/Write data memory using one 61256 whose address is from 0000 to 3FFF anfd 0000 to FEFF. Start address End address IC used Total capacity

Socket address 4100(pgm/data memory) 32Kbytes 0000(data memory) 32kbytes 0000(data memory) 32kbytes BFFF U6 61256x1

3FFF FEFF

U8 U8

61256x1 61256x1

Power Supply Specification Input : Output 230V,AC 50Hz : DC outputs

+5V/3A regulated +12V/150mA regulated +30V/300mA unregulated This power supply has four stable outputs with different current ratings. On-chip features of 8051 8051 is Intels most powerful 8-bit micro controller.It has got 8-bit CPU optimized for control application,64K program memory space,4K byutes of on-chip program memory,128 bytes of on-chip data memory,32 bits directional and individually addressable I/O lines,two 16 bit timer/counter,one full duplex serial port and 6 source,5 vector interropt stucture with two priority level on-chip. On-chip features of 89C51 89C51 is Philips most powerful 8-bit microcontroller.It has got an 8-bit CPU optimized for control application,external 64K program memory space,64K external data memory space,64K on-chip flash program memory,1K byte of on-chip data RAM,32 bi-

directional and individually addressable I/O lines,three 16 bit timer/counter,one full duplex serial port,7 interrupt sources with priority level. Parallel port Port 0 (P0.0-P0.7) 1) Devise used : 8051/895C1

2) Key features : All lines of port0 are bi-directional and each line consist of a latch,an o/p driver and an I/p driver.The O/P drivers and I/P driver and I/P buffers of port0 are used in acess to external memory. 3) Address : Port0 can be botyh bit and byte addressed.The addresses of P0.0-P0.7 are 80-87(bit address) and the address is 80 when byte addressed. Port 1 (P1.0-P1.7) 1) Device used : 8051/89C51

2) Key features : All lines are bi-directional and each consist of a latch,an O/P driver and an I/P buffer 3) Address : Port1 can be both bit and byte addressed.The address of P1.0-P1.7 are 90-97 and address is 90 when byte addressed. Port 2 (P2.0-P2.7) 1) Device used : Intel 8051/89C51

2)Key features : All lines are bi-directional and each consist of a latch,an O/P driver and an I/P driver 3)Address : Port2 can be both bit and byte addressed.The address of P2.0-P2.7 are A0-A7 and address is A0 when byte addressed. Port 3(P3.0-P3.7) 1)Device used : Intel8051/89C51

2)Key features : All lines are bi-directional and each consist of a latch,an O/P driver and an I/P buffer. P3.0-P3.7 are multi directional 3)Address : Port3 can be both bit and byte addressed.The address of P3.0-P3.7 are B0-b7 and address is B0 when byte addressed.

TIMERS/COUNTERS 1) Device used : 8051/89c51

2) Key features : 8051 has two 16-bit timers/counters 0 and timer/counter 1.They have 4 operating modes 3) Address : Timer/counter control Timer/counter mode control Timer/counter 0 high byte 8C Timer/counter 0 low byte 8A Timer/counter 1 high byte 8D Timer/counter 1 low byte 8B Note 895C1 has three 16 bit timers/counters registers.Two timers are same as 8051. 88 89

EXP.NO:12

8 BIT ARITHEMATIC
AIM: TO WRITE A PROGRAM IN ASSEMBLY LANGUAGE TO DO THE FOLLOWING OPERATIONS ON 8-BIT NUMBERS. (1) ADDITION (2) SUBTRACTION (3) MULTIPLICATION (4) DIVISION (1) ADDITION ALGORITHM:

PROGRAM:

LABEL

ADDRES S 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E

MNEMONICS MOV DPTR,#4200

HEXCODE 90 42 00

COMMENTS Move 4200H to DPTR

MOV R0,#00

78 00

Clear R0

MOVX A,@DPTR MOV B,A

E0 F5 F0

Move content of DPTR to A Move A to B

INC DPTR MOVX A,@DPTR ADD A,B

A3 E0 25 F0

Increment DPTR Move content of DPTR to A ADD A & B

JNC LABEL1

50 01

If CY=0,jump LABEL1

to

INC R0 INC DPTR MOVX @DPTR,A

08 A3 F0

Increment R0 Increment DPTR Move content of

LABEL1

410F 4110

accumulator DPTR 4111 4112 4113 INC DPTR MOV A,R0 MOVX @DPTR,A A3 E8 F0 Increment DPTR Move R0 to A Move content accumulator DPTR

to

of to

HERE

4114 4115

SJMP HERE

80 FE

OBSERVATION ADDRESS 4200 4201 4202 4303 DATA FF FF FE 01 INPUT/OUTPUT INPUT INPUT OUTPUT OUTPUT

(2) SUBTRACTION ALGORITHM: PROGRAM: LABEL ADDRESS 4100 MNEMONICS MOV DPTR,#4200 HEXCODE 90 COMMENTS Move 4200H to DPTR

4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E LABEL1 410F 4110 INC R0 INC DPTR MOVX @DPTR,A JNC LABEL1 INC DPTR MOVX A,@DPTR SUBB A,B MOVX A,@DPTR MOV B,A MOV R0,#00

42 00 78 00 E0 F5 F0 A3 E0 95 F0 50 01 08 A3 E0 Increment R0 Increment DPTR Move content of accumulator to DPTR Increment DPTR Move R0 to A If CY=0,jump to LABEL1 Increment DPTR Move content of DPTR to A Subtract B from A Move content of DPTR to A Move A to B Clear R0

4111 4112

INC DPTR MOV A,R0

A3 E8

4113

MOVX @DPTR,A

F0

Move content of accumulator to DPTR

HERE

4114 4115

SJMP HERE

80 FE

OBSERVATION

ADDRESS 4200 4201 4202 4203

DATA 02 07 05 00

INPUT/OUTPUT INPUT INPUT OUTPUT OUTPUT

(4) MULTILPICATION ALGORITHM: PROGRAM: LABEL ADDRES S 4100 MNEMONICS MOV DPTR,#4200 HEXCOD E 90 COMMENTS Move 4200H to DPTR

4101 4102 4103 4104 4105 4106 4107 4108 4109 410A INC DPTR MOVX A,@DPTR MUL AB INC DPTR MOVX @DPTR,A MOVX A,@DPTR MOV B,A

42 00 E0 F5 F0 A3 E0 A4 A3 F0 Increment DPTR Move content of DPTR to A Multiply A and B Increment DPTR Move content of accumulator to required location Move B to A Move content of DPTRto A Move A to B

410B 410C 410D 410E

MOV A,B

E5 F0

INC DPTR MOVX @DPTR,A

A3 F0

Increment DPTR Move content of accumulator to required location

HERE

410F 4110

SJMP HERE

80 FE

OBSERVATION

ADDRESS 4200 4201 4202 4203

DATA FF FF 01 FE

INPUT/OUTPUT INPUT INPUT OUTPUT OUTPUT

(3) DIVISION ALGORITHM: PROGRM: LABEL ADDRES S 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 INC DPTR MOVX A,@DPTR MOVX A,@DPTR MOV B,A MOV R0,#00 MNEMONICS MOV DPTR,#4200 HEXCOD E 90 42 00 78 00 E0 F5 E0 A3 E0 Increment DPTR Move content of DPTR to A Move content of DPTR to A Move A to B Clear R0 COMMENTS Move 4200H to DPTR

410A 410B 410C

DIV AB INC DPTR MOVX @DPTR,A

84 A3 F0

Divide A & B Increment DPTR Move content of accumulator to required location Move B to A

410D 410E 410F 4110

MOV A,B

E5 F0

INC DPTR MOVX @DPTR,A

A3 F0

Increment DPTR Move content of accumulator to required location

4111 HERE

SJMP HERE

80

FE

OBSERVATION ADDRESS 4200 4201 4202 4203 DATA 03 0C 04 00 INPUT/OUTPUT INPUT INPUT OUTPUT OUTPUT

EXP NO:13

MULTIBYTE ADDITION
ALGORITHM PROGRAM PROGRAM: LABEL ADDRES S 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B MNEMONICS HEXCODE COMMENTS

410C 410D 410E LABEL1 410F 4110 4111 4112 4113 HERE 4114 4115 OBSERVATION ADDRESS 4200 4201 4202 4303 DATA INPUT/OUTPUT

EXP NO:14

AVERAGE OF N NUMBERS
ALGORITHM PROGRAM

PROGRAM: LABEL ADDRES S 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E LABEL1 410F 4110 4111 MNEMONICS HEXCODE COMMENTS

4112 4113 HERE 4114 4115 OBSERVATION ADDRESS 4200 4201 4202 4303 DATA INPUT/OUTPUT

EXP NO:15

SORTING(ASCENDING ORDER)
ALGORITHM PROGRAM PROGRAM: LABEL ADDRES S 4100 MNEMONICS HEXCODE COMMENTS

4101 4102 4103 4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E LABEL1 410F 4110 4111 4112 4113 HERE 4114

4115 OBSERVATION ADDRESS 4200 4201 4202 4303 DATA INPUT/OUTPUT

EXP NO:16

FIBONACCI SERIES OF A SET OF GIVEN NUMBERS


ALGORITHM PROGRAM PROGRAM: LABEL ADDRES S 4100 4101 4102 4103 MNEMONICS HEXCODE COMMENTS

4104 4105 4106 4107 4108 4109 410A 410B 410C 410D 410E LABEL1 410F 4110 4111 4112 4113 HERE 4114 4115 OBSERVATION ADDRESS DATA INPUT/OUTPUT

4200 4201 4202 4303

EXP NO:17

SEPERATION OF LOWER AND UPPER NIBBLES


ALGORITHM
PROGRAM: LABEL ADDRES S 4100 MNEMONICS MOV DPTR,#4200 HEXCODE COMMENTS MOVE THE CONTENT OF 4200 TO DPTR

4101 4102 4103 MOVX A,@DPTR MOVE CONTENT OF DPTR TO A

4104 4105 4106 4107 MOV B,A MOV R3,A ANL A,#0F MOVE CONTENT OF A TO B MOVE CONTENT OF A TO R3 AND A WITH IMMEDIATE VALUE 0F INCREMENT DPTR MOVE CONTENT OF DPTR TO A MOVE CONTENT OF R3 TO A SWAP LOWER AND UPPER NIBBLES AND A WITH OF

4108 4109 410A 410B 410C 410D 410E 410F HERE OBSERVATION ADDRESS 4200 4201 4110

INC DPTR MOVX A,@DPTR MOV A,R3 SWAP A ANL A,#0F

INC DPTR MOVX @DPTR,A SJMP HERE

INCREMENT DPTR MOVE VALUE ACXC TO DPTR STOP OF

DATA A5 05

INPUT/OUTPUT INPUT OUTPUT

4202

0A

OUTPUT

EXP NO:18

ARRAY MULTIPLICATION
ALGORITHM

PROGRAM: LABEL ADDRES S 4100 4101 4102 4103 4104 4105 4106 MNEMONICS HEXCODE COMMENTS

4107 4108 4109 410A 410B 410C 410D 410E LABEL1 410F 4110 4111 4112 4113 HERE 4114 4115 OBSERVATION ADDRESS 4200 4201 4202 DATA INPUT/OUTPUT

4303

EXP.NO:19

CODE CONVERSION
AIM: TO WRITE A PROGRAM IN ASSEMBLY LANGUAGE TO PERORM (a)DECIMAL TO ASCII (b)HEXADECIMAL TO DECIMAL (c)HEXADECIMAL TO BCD (d)ASCII TO HEXADECIMAL (a)DECIMAL TO ASCII ALGORITHM: PROGRAM: LABEL ADDRES S MNEMONICS HEXCOD E COMMENTS

OBSERVATION DATA ADDRESS INPUT/OUTPUT

(b)HEXADECIMAL TO DECIMAL

ALGORITHM: PROGRAM: LABEL ADDRES S MNEMONICS HEXCOD E COMMENTS

OBSERVATION DATA ADDRESS INPUT/OUTPUT

RESULT: THE PROGRAM FOR CONVERTNG (1)DECIMAL TO ASCII AND (2)HEXADECIMAL TO DECIMAL IS DONE , EXECUTED AND OUTPUT IS VERIFIED. (c)HEXADECIMAL TO BCD ALGORITHM: PROGRAM:

LABEL

ADDRES S

MNEMONICS

HEXCOD E

COMMENTS

OBSERVATION DATA ADDRESS INPUT/OUTPUT

(d)ASCII TO HEXADECIMAL ALGORITHM: PROGRAM: LABEL ADDRES S MNEMONICS HEXCOD E COMMENTS

OBSERVATION DATA ADDRESS INPUT/OUTPUT

CYCLE 3
EXP NO:20

INTERFACING 1)STEPPER MOTOR


AIM:TO WRITE A PROGRAM FOR FORWARD AND REVERSE ROTATION OF STEPPER MOTOR USING 8051

PROGRAM: LABEL ADDRES S 4100 MNEMONICS MOV DPTR,#4500 COMMENTS LOADING THE STEPPING SEQUENCE MOV 04 TO R0 MOVE THE CONTENT OF LOCATION POINTED BY DPTR TO ACC PUSH DPH TO STACK PUSH DPL TO STACK MOVE P[ORT ADDRESS OF DATA REGISTOR TO DPTR MOVE 04 TO R2 MOVE FF TO R2 MOVE FF TO R3

4103 L2 4105

MOV R0,#04 MOVX A,@DPTR

4106 4108 410A

PUSH DPH PUSH DPL MOV DPTR,#FFC0

410D 410F L1 4111

MOV R2,#04 MOV R1,#FF MOV R3,#FF

HERE

4113

DJNZ R3,HERE

DECREMENT R3 UNTILL R3 BECOMES ZERO DECREMENT R1 UNTIL R1 BECOMES ZERC DECREMENT R2 UNTIL R2 BECOMES ZERO MOVE A TO ADDRESS OF DPTR TAKE DPTR STACK FROM

4115

DJNZ R1,L1

4117

DJNZ R2,L1

4119 411A 411C 411E 411F

MOVX @DPTR,A POP DPL POP DPH INC DPTR DJNZ R0,L2

INCREMENT DPTR DECREMENT R0 UNTIL R0 BECOMES ZERO JUMP TO START RETURN

HERE

4121 4123

SJMP START RET

FORWARD 4500 DB 09H 05H 06H 0AH REVERSE 4148 DB 0AH 06H 05H 09H

2) 7-SEGMENT DISPLAY INTERFACING


PROGRAM

LABEL

ADDRES S 4100

MNEMONICS MOV DPTR,#FFC2

COMMENTS LOAD THE ADDRESS OF CONTROL REGISTER TO DPTR MODE & DISPLAY[8 BIT CHAR DISPLAY LEFT ENTRY] MOVE ACC CONTENT TO DPTR MOVE CC TO AS FOR CLEARING DISPLAY MOVE ACC CONTENT TO DPTR MOVE 90 TO A FOR WRITE DISPLAY MODE MOVE ACC CONTENT TO DPTR MOVE THE ADDRESS OF DATA REGISTER TO DPTR TO DISPLAY A MOVE ACC CONTENT TO DPTR COUNT FOR REST OF DISPLAY BLANK THE REST OF DISPLAY

4103

MOV A,#00

4105 4106

MOVX @DPTR,A MOV A,#CC

4108 4109

MOVX @DPTR,A MOV A,#90

410B 410C

MOVX @DPTR,A MOV DPTR,#FFC0

410F 4111 4112 4114

MOV A,#88 MOVX @DPTR,A MOV R0,#05 MOV A,#FF

LOOP

4116 4117

MOVX @DPTR,A DJNZ R0,LOOP SJMP HERE

HERE

4119

MOVE ACC CONTENT TO DPTR DECREMENT R0 UNTIL ZERO STOP

3)DIGITAL TO ANALOG CONERTER a)SQUARE WAVE GENERATION


PROGRAM LABEL ADDRES S 4100 START 4103 4105 4106 4109 410B 410C 410F MNEMONICS MOV DPTR,#FFC8 MOV A,#00 MOVX @DPTR,A LCALL DELAY MOV A,#FF MOVX @DPTR,A LCALL DELAY LJMP START COMMENTS MOVE FFC8 TO DPTR MOVE A TO R0 MOVE ACC CONTENT TO DPTR CALL DELAY MOVE FF TO A MOVE ACC TO DPTR CALL DELAY JUMP TO START

DELAY LOOP HERE

4112 4114 4116

MOV R1,#05 MOV R2,#FF DJNZ R2,HERE

MOVE 05 TO R1 MOVE FF TO R2 DECREMENT R2 UNTIL R2 BECOMES ZERO,IF R2 =0,JUMP TO HERE DECREMENT R1 UNTIL R1 BECOMES ZERO,IF R1 =0,JUMP TO LOOP RETURN SHORT START JUMP TO

4118

DJNZ R1,LOOP

411A 411B

RET SJMP START

b)SAWTOTH WAVE GENERATION


PROGRAM

LABEL

ADDRES S 4100

MNEMONICS MOV DPTR,#FFC0

COMMENTS MOVE THE CONTENT OF FFC0 TO DPTR CLEAR A MOVE THE CONTENT OF A TO

4103 LOOP 4105

MOV A,#O0 MOVX @DPTR,A

DPTR 4106 4107 INC A SJMP LOOP INCREMENT A JUMP TO LOOP

c)TRIAGULAR WAVE GENERATION


PROGRAM

AIM: TO PRINT CHARACTER A ON DISPLAY LABEL ADDRES S 4100 MNEMONICS MOV DPTR,#FFC8 COMMENTS MOVE THE CONTENT OF FFC8 TO DPTR CLEAR A MOV THE CONTENT OF A TO DPTR INCREMENT A JUMP IF ZERO TO LOOP1 MOVE FF TO A MOVE CONTENT OF A TO DPTR

START LOOP1

4103 4105 4106 4107 4109

MOV A,#00 MOVX @DPTR,A INC A JNZ LOOP1 MOV A,#FF MOVX @DPTR,A

LOOP2

410B

410C 410F 4110

DEC A JNZ 410B LJMP START

DECREMENT A JUMP IF NOT ZERO TO 410B JUMP TO START