Documente Academic
Documente Profesional
Documente Cultură
AIM: To write an ALP to display a rolling message and read a character from the keyboard using 8279 module. APPARATUS REQUIRED:
1. 8085 Microprocessor kit 2. 8279 Interfacing module 3. Power supply
PROGRAM: ROLLING A DISPLAY: ADDRESS 4100 4103 4105 OPCODE 21,--,-16,0F 3E,10 LABEL L2 MNEMONICS LXI H,----MVID,0F MVIA,10 COMMENTS Initialize HL reg with the Address-----Initialize D reg. with the count value(0F)H Initialize the Acc. With the control word(10)H for display mode setup Control word is placed in Control register whose address is(C2)H Initialize the Acc. With the control word (CC) H for clear display. Control word is placed in Control register whose address is (C2)H Initialize the Acc. With the control word (90) H for write display. Control word is placed in Control register whose address is (C2)H Move the content of M to Accumulator
4107
D3,C2
OUT C2
4109
3E,CC
MVI A,CC
410B
D3,C2
OUT C2
410D
3E,90
MVI A,90
410F
D3,C2
OUT C2
4111
7E
L1
MOV A,M
Display the word on display reg Call the subroutine Increment HL reg pair Increment D reg content Jump to L1 if zero flag is not set Jump to L2
411C
C3,00,41
JMP L2
CALL DELAY ADDRESS 4200 4202 4204 4205 4208 4209 420C OPCODE 06,A0 0E,FF 0D C2,04,42 05 C2,02,42 C9 LABEL MNEMONICS MVI B,A0 MVI C,FFH DCR C JNZ L2 DCR B JNZ L1 RET COMMENTS Initialize B reg with the count(A0)H Initialize C reg with the count(FF)H Decrement the C reg Jump to Loop L2 if zero flag is not set Decrement the B reg Jump to Loop L1 if zero flag is not set Return to the main program
L1 L2
READING THE KEY: ADDRESS 8000 8001 8004 OPCODE DB, C2 E6,07 CA,00,80 LABEL L1 MNEMONICS IN C2 ANI 07 JZ L1 COMMENTS FIFO Status Check for a key closure If key closure is encountered, then jump to L1 Load the control word Read the output Read of FIFO RAM Store the result Stop the program
Result: Thus an ALP to display a rolling message and read the character from the keyboard were written and executed using 8279 module.
ROLLING A DISPLAY 1. Display Mode command format DD-Display Mode Control word-(10) H B7 B6 B5 B4 0 0 0 1 0 0 0 D 00011011-
B3 0 D
B2 0 K
B1 0 K
B0 0 K
8 Bit character display left entry 16Bit character display left entry 8 Bit character display right entry 16Bit character display right entry
KKK- Keyboard Mode 000-Encoded scan Keyboard -2Key lockout MEMORY HEX DATA LOCATION 7-SEGMENT LED FORMAT d c b a Dp g f OUTPUT e
SERIAL COMMUNICATION USING 8251 AIM: To perform a program for serial communication using 8251 APPARATUS REQUIRED: 1. Microprocessor kit 2. Power supply PROGRAM FOR THE TRANSMITTER:
ADDRESS LABEL MENMONICS 4100 START MVI A,36 4101 OUT CE 4104 MVI A,0A 4106 OUT C8 4108 MVI A,00 410A OUT C8 410C MVI A,4E 410E OUT C1 4110 MVI A,37 4111 OUT C1 4114 MVI A,41 4116 OUT C0 4118 RST 1
OPCODE 3E,36 D3,CE 3E,0A D3,C8 3E,0 D3,C8 3E,4E D3,C1 3E,37 D3,C1 3E,41 D3,C0 CF
COMMENTS Move 36 to A Go to out port C0 Move 0A to A Go to out port C8 Move 00 to A Go to out port C8 Move 4E to A Go to out port C1 Move 37 to A Go to out port C1 Move 41 to A Go to out port C0 reset
PROGRAM FOR THE RECEIVER: ADDRESS 4100 4101 4105 LABEL MNEMONICS OPCODE COMMENTS INCO STA 4150 RST DB,CO 31,50,47 CF Send to CR Store the result in address STOP
RESULT: Thus the program for serial communication by using 8251 was executed and output was verified.
I/O table:
STEPPER MOTOR CONTROL USING 8051 AIM: To run a stepper motor at different speeds using 8051microcontroller. APPARATUS REQUIRED: 1. 2. 3. 4. 8051 microcontroller Stepper motor interface Stepper motor 50 pin cable
PROCEDURE: 1. Connect the stepper motor interface board and stepper motor with 8051 micro controller with cable 2. Turn ON the power supply 3. Enter the program in 8051 kit and execute it 4. To change the speed of the motor change the delay value 5. To change the directions of rotation reverse the values given in the label table in program ALGORITHM: 1. 2. 3. 4. 5. 6. Load the address of the control port in the DPTR Load the control word in control register Move the first data to accumulator and to port a Run the delay Get the next data to accumulator and procedure is repeated till the count becomes zero Go to step 1
ADDRESS LABEL MNEMONICS COMMENTS 8500 MOV DPTR,#4003 CONTROL PORT OF 8251
8503
MOV A,#80
CONTROL WORD
L1
MOVX @DPTR,A MOV DPTR#4000 MOV A,#A0 MOV X@DPTR,A LCALL 9100
ALL BITS OUTPUTS MOVE CONTROL WORD TO CNTRL REG 1ST SEQUENCE OUT IT IN PORT A DELAY SUBROUTINE
850F 8511 8512 8515 8517 8518 851B 851D 851E 8521
MOV A,#E0 MOV X@DPTR,A LCALL 9100 MOV A,#C0 MOV X@DPTR,A LCALL 9100 MOV A,#80 MOV X@DPTR,A LCALL 9100 LJMP 8509
2ND SEQUENCE OUT IT IN PORT A DELAY SUBROUTINE 3RD SEQUENCE OUT IT IN PORT A DELAY SUBROUTINE 4TH SEQUENCE OUT IT IN PORT A DELAY SUBROUTINE REPEAT
DELAY SUBROUTINE
ADDRESS 9100 9102 9104 9105 9106 9107 9108 9109 910B 910D
LABEL L1
MNEMONICS MOV R1,#0A MOV A,#40H NOP NOP NOP NOP DEC A JNZ 9104 DJNZ R1,9102 RET
8503
MOV A,#80
CONTROL WORD
8505 8506 8509 850B 850C 850F 8511 8512 8515 8517 8518 851B 851D 851E 8521
L1
MOVX @DPTR,A MOV DPTR#4000 MOV A,#C0 MOV X@DPTR,A LCALL 9100 MOV A,#E0 MOV X@DPTR,A LCALL 9100 MOV A,#A0
ALL BITS OUTPUTS MOVE CONTROL WORD TO CNTRL REG 1ST SEQUENCE OUT IT IN PORT A DELAY SUBROUTINE 2ND SEQUENCE OUT IT IN PORT A DELAY SUBROUTINE 3RD SEQUENCE
MOV X@DPTR,A OUT IT IN PORT A LCALL 9100 MOV A,#80 DELAY SUBROUTINE 4TH SEQUENCE
MOV X@DPTR,A OUT IT IN PORT A LCALL 9100 LJMP 8509 DELAY SUBROUTINE REPEAT
RESULT: Thus the program to run the stepper motor was executed and the change of direction of rotation and speed was noted.
AIM: To obtain square wave, saw tooth, triangular wave form using DAC and 8085 microprocessor.
APPARATUS REQUIRED: 1. 8085 microprocessor 2. CRO 3. Power supply 4. DAC interfacing cable
ALGORITHM: 1. Load the control word in 40F3. 2. Make the accumulator content 00 and sent it to output port i.e., port address 40F1. 3. Call the delay subroutine. 4. Make the accumulator content FF and sent it to output port address 40F1. 5. Repeat the above steps in infinite loop.
PROGRAM FOR SQUARE WAVE GENERATION: ADDRESS 8000 LABEL MNEMONICS MVI A,80 OPCODE COMMENTS 3E, 80 Move control accumulator word to
Go to the output port 43 Move the data to accumulator Go to the output port 41 Call the specified address Move immediate accumulator data to
Go to the output port 41 Call the specified address Jump and then go to LOOP Move the immediate data to B register Move the immediate data to C register Decrement the C register Jump if no zero go to L1 Decrement the B register Jump if no zero go to L2 Return to main program
8017
L2
MVI C, 1F
0E,1F
L1
0D C2,19,80 05 C2,17,80 C9
SAWTOOTH WAVE: ADDRESS 8000 LABEL START MENMONICS OPCODE COMMENTS MVI A,00 3E,00 Move the immediate data to accumulator Get the output port to 43 Increment the accumulator Jump if no zero then go to L1 Jump and then go to start
L1
TRIANGULAR WAVE: ADDRESS LABEL MNEMONICS OPCODE COMMENTS 8000 8002 8003 8005 8006 8009 800B 800C 800E 800F 8012 L2 START L1 MVI L,00 MOV A,L OUT C0 INR L JNZ L1 MVI L,FF MOV A,L OUT C0 DCR C JNZ L2 JMP START 2E,00 7D D3,43 2C C2,02,80 2E,FF 7D D3,43 0D C2,0B,80 C3,00,80 Move the immediate data to L register Move the content of L to accumulator Get the output port to 43 Increment the L register Jump if no zero then go to L1 Move the immediate data to L register Move the immediate data to L register Get the output port to 43 Decrement the C register Jump if no zero then go to L2 Jump then go to start
RESULT: Thus the program for obtaining square wave, using DAC was performed and the corresponding waveforms were viewed in CRO.
AMPLITUDE
TIME PERIOD
AMPLITUDE
TIME PERIOD
AMPLITUDE
TIME PERIOD
AIM: To write the program to perform analog to digital conversion using 8085 microprocessor kit.
APPARATUS REQUIRED: 1. 8085 microprocessor kit 2. ADC interface kit 3. Power supply PROCEDURE: 1. Connect the 5 v and ground power supply to trainer kit and ADC cord. 2. Connect the 50 pin connector from the kit to the ADC cord. 3. Connect the cord from keyboard into the socket provided in the kit. 4. Switch on the power supply. 5. Assemble your program. 6. Vary the pot in the ADC chord. 7. Execute the program and view the output count in the accumulator, which will be displayed in the LCD display. 8. Every time you vary the pot, execute the program and measure the count value in the accumulator. 9. Repeat the above step for different inputs in the pot.
PROGRAM: ADDRESS LABEL MNEMONICS OPCODE COMMENTS 8500 MOV A,90 Control word for port A as input port Port B and port C as output port
8502 8505 8507 850A 850C 850F 8511 8514 8517 851A 851B 851D 851F 8520 8521 8522 8525 8526 8529
STA 40F3 MVIA,FF STA 40F2 MVI A,FF STA 40F2 MVI A,00 STA 40F2 CALL 851B LDA 40F0 RST 1 MVIB,FF MVIA,FF NOP NOP DCR A JNZ851F DCRB JNZ851D RET Delay routine Read data through port A Port C is enabled for start conversion pulse
RESULT: Thus the ADC is interfaced and readings are tabulated for various analog output voltages.
OUTPUT:
ANALOG INPUT
DIGITAL OUTPUT
INTERRUPT CONTROLLER AIM: To write a program to identify the raised interrupt number. APPARATUS REQUIRED: 1. 8051 Microcontroller 2. Power supply 3. 8259 Module
DESCRIPTION: This program will show which IRQ is raised. If the IRQ-0 is raised then the result will be in accumulator, A=01(in binary 0000 0001). For other IRQs their corresponding, bit patterns will be displayed in accumulator as follows If IRQ1 is raised, A=02; (0000 0010) If IRQ2 is raised, A=04; (0000 0100) If IRQ3 is raised, A=08; (0000 1000) If IRQ4 is raised, A=10; (0001 0000) If IRQ5 is raised, A=20; (0010 0000) If IRQ6 is raised, A=40; (0100 0000) If IRQ7 is raised, A=80; (1000 0000) To get this, every IRQ service routine should read the 8259 register as follows LDA 6000 RST 1
; break point
ICW control word for IRQs Since ICW1=1E is selected, the vector location will start from 9000 to 901C (for 8 interrupts) 4 byte for each IRQs.
STEPS: 1. Connect the monostable multivibrator output to the desired IRQ input connector (e.g. connect to IRQ0). 2. Now type the program and execute it. The kit will wait for an interrupt to occur. 3. Now press the switch to trigger the monostable multivibrator to raise the interrupt to IRQ0. 4. Now the kit shows A=01 which indicates IRQ0 is pressed. PROGRAM: ADDRESS 8500 OPCODE 3E, 1E MNEMONICS MVI A, 1E COMMENTS ICW1 cntr word for IRQs Vector location Write the byte to 8259 register Higher byte of JMP address
8502
32,00,60
STA 6000
8505
3E,90
MVI A, 90
INTERRUPT SERVICE ROUTINES: INTERRUPT ADDRESS IRQ0 9000 9003 IRQ1 9004 9007 IRQ2 9008 OPCODE 3A, 00, 60 CF 3A, 00, 60 CF 3A, 00, 60 MNEMONICS LDA 6000 RST1 LDA 6000 RST1 LDA 6000 COMMENTS
900B IRQ3 900C 900F IRQ4 9010 9013 IRQ5 9014 9017 IRQ6 9018 901B IRQ7 901C 901F
CF 3A, 00, 60 CF 3A, 00, 60 CF 3A, 00, 60 CF 3A, 00, 60 CF 3A, 00, 60 CF
RST1 LDA 6000 RST1 LDA 6000 RST1 LDA 6000 RST1 LDA 6000 RST1 LDA 6000 RST1
RESULT: Thus the interrupt controller program using 8085 was written and executed successfully.