Documente Academic
Documente Profesional
Documente Cultură
COLLEGE OF ENGINEERING
Sir.C.V.Raman Nagar, Tirunelveli-12
: : : :
3 4 5 6 7
8 9 10 11
12 13 14 15
16 17
ADDRESS LABEL 4100 4102 4104 4105 4108 410A 410D 410E 410F 4112 START
MNEMONICS MVI A, 35 MVI B, 12 ADD B STA 4200 MVI C, 00 JNC L1 INR C MOV A, C STA 4201 HLT
L1
Sub Code: EC 58 Microprocessors and Microcontrollers Lab INPUT: 4101-35 4103-12 OUTPUT: 4200-47 4201-00 MANUAL CALCULATION:
8-BIT SUBTRACTION AIM To write an ALP to perform 8-bit subtraction using 8085 microprocessor trainer kit.
APPARATUS REQUIRED 1. 8085 microprocessor trainer kit. 2. Power supply ALGORITHM 1. Start the program 2. Get the first data to the accumulator. 3. The second data is given to B register. 4. The content of B register is then subtracted with accumulator contents. 5. The addition for carry is checked and the result is stored in the specified memory location. 6. The program is terminated.
PROGRAM
ADDRESS LABEL 4100 4102 4104 4105 4108 410A 410D 410E 410F 4112 START
MNEMONICS MVI A, 35 MVI B, 12 SUB B STA 4200 MVI C, 00 JNC L1 INR C MOV A, C STA 4201 HLT
OPCODE
L1
Sub Code: EC 58 Microprocessors and Microcontrollers Lab 4101-35 4103-12 OUTPUT: 4200-23 4201-00 MANUAL CALCULATION:
8-BIT MULTIPLICATION AIM To write an ALP to perform 8-bit multiplication using 8085 microprocessor trainer kit. APPARATUS REQUIRED 1. 8085 microprocessor trainer kit. 2. Power supply ALGORITHM 1. Start the program 2. Clear the accumulator 3. Get the first data to the register B. 4. Get the second data to the register C. 5. Add the contents of register B is added with the accumulator and stored in accumulator. 6. After performing the addition operation the register C would decremented by 1 7. When the zero flag is set, the result was stored in the specified memory location. 8. Otherwise the loop of addition operation was continued.
PROGRAM
ADDRESS LABEL 4100 4102 4104 4106 4107 4108 410B 410E START
MNEMONICS MVI A, 00 MVI B, 12 MVI C, 45 ADD B DCR C JNZ L1 STA 4200 HLT
OPCODE
L1
8-BIT DIVISION AIM To write an ALP to perform 8-bit division using 8085 microprocessor trainer kit. APPARATUS REQUIRED 1. 8085 microprocessor trainer kit. 2. Power supply ALGORITHM 1. Start the program 2. Clear the accumulator and load the accumulator by divisor value to the specified memory location. 3. Move the content of A to B register. 4. Load accumulator with dividend value. 5. Initialize 00 to C register. 6. Compare B register with accumulator. 7. If carry is generated move to the 11th step. 8. Subtract the B register content from the accumulator. 9. Increment the content of C register. 10. Jump control to step 6. 11. Store the remainder in accumulator in specified memory location. 12. Move the C register content to accumulator. 13. Store the quotient value in accumulator. 14. End the program. PROGRAM ADDRESS LABEL START MNEMONICS SUB A LDA 4200 MOV B,A LDA 4201 MVI C,00 CMP B JC L2 SUB B INR C JMP L1 STA 4250 MOV A,C STA 4251 HLT OPCODE
L1
L2
OUTPUT:
MANUAL CALCULATION:
RESULT: Thus the ALP was written and the 8 bit arithmetic operations were performed successfully using 8085 microprocessor trainer kit.
EX.NO. :2
Einstein College of Engineering Page 10 of 76
DATE
16-BIT ADDITION AIM To write an ALP to perform 16-bit addition using 8086 microprocessor trainer kit. APPARATUS REQUIRED 1. 8085 microprocessor trainer kit. 2.Power supply ALGORITHM
PROGRAM
INPUT:
OUTPUT:
MANUAL CALCULATION:
RESULT: Thus the ALP was written and the 16-bit arithmetic operations was performed successfully by using the 8086 microprocessor trainer
STEP 1 1
0 1
09 1 05 2 1 0 0 1 1 1 0 0 A 06
3 4
0 1
1 0
1 1
0 0
06 0A
3 4
0 1
1 0
0 0
1 1
05 09
1018
LOOKUP
ADDRESS
LABEL
MNEMONICS
OPCODE
RESULT: Thus a program to run a stepper motor at different speeds in two directions was written and executed using 8086 p
AIM: To write an assembly language program to convert analog to digital output APPARATUS REQUIRED: 8085 p kit, ADC board, Interface chord, Power chord. ALGORITHM: 1. Load the data 10 H to make the ALE signal low. 2. Load the data 18 H to make the ALE signal low. 3. Place jumper J2 in B position. 4. Place jumper J5 in A position. 5. Enter & execute the program. 6. Vary the analog input (using prompt) and give the SOC (by pressing the SOC switch). 7. Set the corresponding digital value in the LED display.
THEORY: The device contains an 8 channel single ended analog signal multiplexer. A particular input channel is selected by using the address decoding. I/O decoding A 3:8 decoder 74LS138 is employed to generate I/O decoding logic. The address lines A3, A4, and A5 are tied to pin 1, 2, 3 of 74LS138 respectively. The address lines A6 and A7 are NANDed together and the NAND gate o/p is connected to pin 5 of 74LS 138.similarly IOW and IOR signals NANDed together and the NAND gate o/p is connected to pin 6 of 74LS 138. Pin 4 is grounded. The buffer 74LS244 which transfers the converted data output to data bus is selected when
A7 1
A6 1
A5 0
A4 0
A3 0
A2 X =C0 H
A1 X
A0 X
The I/O address for the latch 74LS174 which latches the data bus to address A,B,C and ALE1 and ALE 2. A7 1 A6 1 A5 0 A4 0 A3 1 A2 X =C8 Data to be outputted to port address C8 for channels 0 to 7 S.No Channel No EOC address in Hexa Data in Hex Channel No Channel No ALE High ALE Low OE Low OE High 18 10 19 11 1A 12 1B 13 1C 14 1D 15 1E 16 1F 17 A1 X A0 X
1 2 3 4 5 6 7 8
D8 D8 D8 D8 D8 D8 D8 D8
PROGRAM:
ADDRESS
LABEL
MNEMONICS MVI A,10 OUT 0C8 H MVI A,18 OUT 0C8 H HLT
OPCODE
MANUAL CALCULATION
RESULT: Thus the assembly language program to convert analog to digital output digital output was executed successfully.
CIRCUIT IMPLEMENTATION: The basic DAC interface board incorporates two 8 bit digital to analog converters, DAC0800.The DAC interface section comprises of I/O decoding and D/A conversion circuit.
I/O decoding
A 3:8 decoder 74LS138 is employed to generate I/O decoding logic. The address lines A3, A4, and A5 are tied to pin 1, 2, 3 of 74LS138 respectively. The address lines A6 and A7 are NANDed together and the NAND gate o/p is connected to pin 5 of 74LS 138.similarly IOW and IOR signals NANDed together and the NAND gate o/p is connected to pin 6 of 74LS 138. Pin 4 is grounded. Thus with A7 1 =C0 H A6 1 A5 0 A4 0 A3 0 A2 X A1 X A0 X
A7 1
A6 1
A5 0
A4 0
A3 1
A2 X =C8
A1 X
A0 X
DAC2 is selected
The o/p voltage between -5V and 5V.the o/p voltage varies in steps of 10/256=.04 i/p data in hexa o/p voltage 00 01 02 .. .. .. 7F .. FD FE FF -5.00 -4.96 -4.92 .. .. .. 0.00 .. 4.92 4.96 5.00
SQUARE WAVEFORM AT DAC 2 OUTPUT: ALGORITHM: 1. Clear the accumulator to Display low level of square wave 2. Send the data to o/p device through port 3. Call the delay program. 4. Load the accumulator with FF to Display high level of square wave 5. Send the data to o/p device through port 6. Call the delay program 7. Continue from step1 PROGRAM:
ADDRESS
LABEL
MNEMONICS
OPCODE
OUTPUT:
ALGORITHM : 1. Clear the accumulator 2. Send the data to o/p device through port 3. Incrment the accumulator to display next o/p voltage. 4. Do the above process until zero flag is set 5. Continue from step1 PROGRAM:
ADDRESS
LABEL
MNEMONICS
OPCODE
OUTPUT:
TRIANGULAR WAVEFORM AT DAC2OUTPUT: ALGORITHM: 1. Clear the accumulator through L register. 2. Send the data to o/p device through port 3. Incrment the L register 4. Do the above process until zero flag is set 5. Load the accumulator with FF through L register. Einstein College of Engineering Page 28 of 76
Sub Code: EC 58 Microprocessors and Microcontrollers Lab 6. Send the data to o/p device through port 7. Incrment the L register 8. Do the above process until zero flag is set 9. Continue from step1
PROGRAM:
OPCODE MOV BL,00 MOV AL,BL OUT C8,AL INC BL JNZ 1003 MOV BL,FF MOV AL,BL OUT C8,AL DEC BL JNZ 100E JMP 1000
OUTPUT:
SINE WAVEFORM GENERATION AT DAC1 OUTPUT: ALGORITHM: 1. Load 49 input datas to generate sine wave in lookup table 2. Load the count as 49 in C register 3. Send the data to o/p device through port 4. Load the next data 5. Decrement the count and check if it is zero 6. If zero go to the loop or else go to step 1
FORMULA USED: 128+128 SINX WHERE X=0 to 360 with step 5 EXAMPLE:
DEGREES
DECIMAL
HEXA
128
80
PROGRAM:
ADDRESS LABEL
MNEMONICS MOV BX,1100 MOV CL,49 MOV AL,[BX] OUT C0,AL INC BX LOOP 1007 JMP 1000 80,8B,96,A1,AB,B6, C0,C9,D2,DA,E2,E8, EF,F4,F8,FB,FE,FF, FF,FF,FF,FE,FB,F8, F4,EF,E8,E2,DA,D2, C9,C0,B6,AB,A1,96 ,8B,80,74,6A,5F,54, 4A,40,36,2E,25,1E, 17,11,0C,08,04,02,00, 00,00,02,04,08,0C,11, 17,1E,25,2E,36,40, 4A,54,5F,6A,74,80
OPCODE
1100
LOOKUP
RESULT: Thus the square, saw tooth, triangular and sine waveforms were generated using 8086 p.
A7 A6 A5 A4 A3 A2 A1 A0 Hexa Control register 1 1 0 0 1 1 1 0 CE Channal 0 1 1 0 0 1 0 0 0 C8 Channal 1 1 1 0 0 1 0 1 0 CA Channal 2 1 1 0 0 1 1 0 0 CC The chip 8253 has a control register which stores the operational mode of each counter. This register can only be within into, no read operation of its contents are possible .Each counter of 8253 can be individually programmed by writing corresponding control words by simple I/O operation. CONTROL WORD FORMAT: D7 D6 D7 D5 D3 D0 D5 D4 D3 D2 D1 D0
RD/WR D5 0 0 1 1 MODE 0 1 2 3 4 5
D4 0 1 0 1
D7 D6 0 0 -------------Channel 0
D5 D4 1 1 -------------LSB/MSB
D7 D6 0 0 -------------Channel 0
D5 D4 1 1 -------------LSB/MSB
ALGORITHM: 1. Load the accumulator with control word for channel 0and mode 0 selection. 2. Move the data to control register. 3. Load the MSB and LSB of count 4. Move the data to data register
OUTPUT:
OUTPUT:
ADDRESS
LABEL START
MNEMONICS MOV AL,30 0UT CE,AL MOV AL,05 OUT C8,AL MOV AL,00 OUT C8,AL HLT
OPCODE
ALGORITHM: MODE 3- SQUARE WAVE GENERATOR 1 Load the accumulator with control word for channel 0and mode 3 selection. 2 Move the data to control register. 3 Load the MSB and LSB of count 4 Move the data to data register
PROGRAM: MODE 3- SQUARE WAVE GENERATOR ADDRESS LABEL START MNEMONICS MOV AL,36 0UT CE,AL MOV AL, OUT C8,AL MOV AL. OUT C8,AL HLT OPCODE
RESULT: Thus the program for 8253 interfacing with 8086 microprocessor was written successfully.
Segment Definition a b c
DD (Display Mode) 00- 8 bit character display left entry 01- 16 bit character display left entry 10- 8 bit character display right entry 11- 16 bit character display right entry KKK (Keyboard Mode) 000-2 Key lockout 0 0
0 =00
Clear Display(110) 1 1
CD
CD
CD
CF
CA
0 =CC H
1 =90 H
0 =40
DU
1 =07
1 =FF
(A) KEYBOARD INTERFACE ALGORITHM: 1. Load the data count in B register 2. Set display mode 3. Move the data to control register. 4. Clear display. 5. Move the data to control register. 6. Write display RAM 7. Move the data to control register 8. Clear the display RAM 9. Move the data to data register. 10. Decrement the count 11. Repeat the step5 for all the data display 12. Check whether the key is pressed or not 13. If the key is pressed go to next step otherwise repeat step 12. 14. Set to read FIFO RAM. 15. Move the data to control register 16. Get the data from the pressed key & display it
ADDRESS
LABEL
MNEMONICS OPCODE
LOOKUP TABLE
0C 99 08 6C
9F 29 09 1A
4A 28 88 68
0B 8F 38 E8
(B) (ROLLING DISPLAY) ALGORITHM: 1. Initialise the counter 2. Set Display mode. 3. Move the data to control register 4. Clear display 5. Move the data to control register 6. set the write display RAM 7. Move the data to control register 8. Get the first data to be displayed 9. Display the data 10. Call the delay subroutine 11. Get the next data & repeat the steps 9,10until the count is zero
RESULT: Thus keyboard & Display were interfaced with 8279 by using 8086microprocessor.
PROGRAM: ADDRESS LABEL MNEMONICS OPCODE START MOV DX,05 DEC DX MOV CX,DX MOV BX,1100 MOVAX,[BX] ADD BX,2 CMP AX,[BX] JB L1 MOV AX,[BX] LOOP L2 MOV [1500],AX HLT
L2
L1
MAXIMUM NUMBER: ALGORITHM: 1. Get the COUNT in CX register and inputs in specified memory location. 2 .Compare the 1st two datas and load the small data in accumulator. 3. Compare the accumulator with the remaining datas and store the largest data in accumulator. 5. Stop the program.
INPUT:
OUTPUT:
MANUAL CALCULATION:
INPUT:
OUTPUT:
PROGRAM:
ADDRESS
LABEL
MNEMONICS OPCODE
START
L2
L1
MOV DX,05 DEC DX MOV CX,DX MOV BX,1100 MOVAX,[BX] ADD BX,2 CMP AX,[BX] JNB L1 MOV AX,[BX] LOOP L2 MOV [1500],AX HLT
RESULT: Thus the ALP for searching largest and smallest numbers from an array of datas was executed using 8086p.
ADDRESS
LABEL
MNEMONICS OPCODE
START L1 L2
L3
MOV CX,05 MOV DX,CX MOV BX,1100 MOV AX,[BX] CMP AX,[BX+2] JB L3 XCHG [BX+2],AX MOV [BX],AX ADD BX,2 LOOP L2 MOV CX,DX LOOP L1 HLT
OUTPUT:
MANUAL CALCULATION:
DESCENDING ORDER : ALGORITHM: 1. Get the number of inputs. 2. Load the inputs in memory location 1100. 3. Compare the 1st and 2nd data. 4. If there is no carry go to step 6. 5. If there is carry exchange two datas. 6. Compare 2nd and 3rd data and repeat the same up to last data. 7. Now, we get the smallest number in the last place. 8. Repeat the steps from 3. 9. Stop the program. PROGRAM:
ADDRESS
LABEL
MNEMONICS OPCODE
START L1 L2
L3
MOV CX,05 MOV DX,CX MOV BX,1100 MOV AX,[BX] CMP AX,[BX+2] JNB L3 XCHG [BX+2],AX MOV [BX],AX ADD BX,2 LOOP L2 MOV CX,DX LOOP L1 HLT
INPUT:
OUTPUT:
MANUAL CALCULATION:
RESULT: Thus an ALP for sorting an array in ascending and descending order were executed using 8086 p.
L1
MOV SI, 2000 MOV DI, 2100 MOV CX, 05 CLD MOV SB LOOP L1 HLT
b) STORING A DATA IN SET OF LOCATIONS: OBJECTIVE: To fill the locations in memory with the byte INPUT:
OUTPUT:
MANUAL CALCULATION:
ALGORITHM: 1. 2. 3. 4. 5. 6.
Load the number of inputs. Load the destination address. Load the data byte. Facilitate auto incrementing of index register. Store the data in the locations up to the last location. Stop the program.
PROGRAM:
ADDRESS
LABEL
MNEMONICS OPCODE
L1
MOV CX, 0006 MOV DI, 1100 MOV AX, 0034 CLD STO SB LOOP L1 HLT
c) CALCULATING THE LENGTH OF A STRING: OBJECTIVE: To find the number of character in a string ALGORITHM 1. 2. 3. 4. 5. 6. 7.
Load the source address. Clear the count register. Load the assumed last data. Increment the count. Compare the data in source register with last data. If both the datas are same, store the count in location 1100. If both the datas are not same, increment the source address and load the second data. 8. Repeat the steps from 4.
INPUT:
OUTPUT:
MANUAL CALCULATION:
PROGRAM:
ADDRESS
LABEL
MNEMONICS OPCODE MOV SI, 1200 MOV DX, FFFF MOV AH, FF INC DX MOV AL,[SI] INC SI CMP AH, AL JNZ L1 MOV [1100], DX HLT
L1
RESULT: Thus the programs for string manipulation operations were performed by using 8086 p.
PROGRAM:
ADDRESS
LABEL
MNEMONICS OPCODE ORG 4100 CLR C MOV A,#09 ADD A,#05 MOV DPTR,#4150 MOVX @DPTR,A INC DPTR MOVX @DPTR,A SJMP STOP
STOP
INPUT:
OUTPUT:
MANUAL CALCULATION:
8-BIT SUBRACTION: ALGORITHM: 1. 2. 3. 4. 5. 6. Clear C register for carry Load the minuend Subtact the subtrahend from minuend If there is no carry,store the result If there is carry, increment the C register and store results Stop the program
PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 CLR C MOV A,#32 SUBB A,#30 MOV DPTR,#4150 MOVX @DPTR,A SJMP STOP
STOP
8-BIT MULTIPLICATION: ALGORITHM: 1. Load the two datas in A and B registers 2. Multiply the two datas 3. Store the result 4. Stop the program
INPUT:
OUTPUT:
MANUAL CALCULATION:
INPUT:
OUTPUT:
MANUAL CALCULATION:
PROGRAM:
ADDRESS
LABEL
MNEMONICS OPCODE ORG 4100 MOV A,#12 MOV B,#12 MUL AB MOV DPTR,#4500 MOVX @DPTR,A INC DPTR MOV A,B MOVX @DPTR,A SJMP STOP
STOP
8-BIT DIVISION: ALGORITHM: 1. Load the dividend and divisor 2. Divide the dividend by divisor 3. Store the quotient and reminder 4. Store the program PROGRAM: ADDRESS LABEL MNEMONICS OPCODE ORG 4100 MOV A,#12 MOV B,#12 DIV AB MOV DPTR,#4500 MOVX @DPTR,A INC DPTR MOV A,B MOVX @DPTR,A SJMP STOP
STOP
RESULT: Thus the 8-bit arithmetic operations like addition, subtraction, multiplication and division by using 8051 microcontroller and cross assembler were performed and executed
ADDRESS
LABEL
MNEMONICS OPCODE ORG 4100 MOV A,#32 ORL A,#F0 MOV DPTR,#4500 MOVX@DPTR,A SJMP STOP
STOP
MASKING THE HIGHER ORDER BYTES: ALGORITHM: 1. Load the given data 2. Set the bit by ANDing that particular bit by 1 3. Store the result and stop the program. PROGRAM:
ADDRESS
LABEL
MNEMONICS OPCODE ORG 4100 MOV A,#32 ANL A,#0F MOV DPTR,#4500 MOVX@DPTR,A SJMP STOP
STOP
RESULT: Thus the program for masking and setting the higher order bits by using 8051 microcontroller and cross assembler were performed and executed .
STOP
RESULT: Thus a program for performing logical operations using 8051 and cross assemler were executed
5.
7.
Sub Code: EC 58 Microprocessors and Microcontrollers Lab 37. What is the function of JNB instruction?