8051 Kit Programs
8051 Kit Programs
PROGRAM:
ADRESS 0PCODE MNEMONICS
PORTS ADDRESS
CONTROL REG 4003
PORT A 4000
PORT B 4001
PORT C 4002
PROCEDURE:
⮚ CONNECT A 20 PIN FRC CABLE BETWEEN 8051 MICROCONTROLLER J1 PORT (MIDDILE PART)
AND THE LED & SWITCH INTERFACE CARD.
⮚ CONNECT USB/PS2 KEYBOARD ON 8051 MICROCONTROLLER JP2 PORT.
⮚ TYPE AND EXECUTE THE PROGRAM BY USING USB/PS2 KEYBOARD.
⮚ NOW TURN ON/OFF THE SWITCHES IN LED &SWITCH INTERFACE CARD AND THE
CORRESPONDING OUTPUT LED WILLM BE TURNED ON/OFF.
AIM:
Interface LED& Switch card with 8051 using 8255.
PROGRAM:
ADRESS OPCODE MNEF0MONICS
9100 90 40 03 MOV DPTR, #4003
PORTS ADDRESS
CONTROL REG 4003H
PORT A 4002H
PROCEDURE:
⮚ Connect a 20 pin FRC Cable between 8051 trainer kit (J3- Third port) and 4x4 Matrix keypad.
⮚ Connect USB/PS2 Keyboard on 8051 Microcontroller JP2port.
⮚ Type and Execute the program. press any key in 4x4 Matrix keyboard the corresponding
value will be displayed in 8051 trainer kits LCD.
⮚ The 8051’s LCD will display output ACC= 0F (When SW16 pressed in matrix)
PROGRAM:
ADRESS OPCODE MNEMONICS
9142 3 RR A
9143 3 RR A
9144 3 RR A
9145 3 RR A
9164 22 RET
ORG 9200H
ORG 9300H
PORT B 4001
PORT C 4002
PROCEDURE:
⮚ Connect a 2o pin FRC cable between 8051 Trainer kits J1 port (middle port) and the traffic
light controller.
⮚ Type the program by using USB/PS2 keyboard.
⮚ Execute the program. Now Traffic light led’s are blinking.
PROGRAM:
ADDRESS OPCODE MNEMONICS
9108 C0 82 PUSH 82
910A 90 40 03 MOV DPTR, #4003
9110 D0 83 POP 83
9112 A3 INC DPTR
911C D0 82 POP 82
911E D0 83 POP 83
9122 C0 83 PUSH 83
9124 C0 82 PUSH 82
912F D0 83 POP 83
9131 A3 INC DPTR
913D 00 NOP
913E DE FC DJNZ R6, LOOP2
9144 22 RET
ORG 9200H
9200 80 DB 80H
9201 21 09 31 09 DB 21H, 09H, 31H, 09H
PROCEDURE:
⮚ Connect a 20 pin FRC cable between 8051 trainer kit J3 port and 12C peripheral interface
card.
⮚ Turn ON DIP Switch SW2 pin 7SEG (12C add-on card).
⮚ Enable 12C Data (SDA0) and clock (SCL0) pins of SW1 (12C Add-on Card).
⮚ Connect USB/PS2 keyboard on 8051 Microcontroller kit. Type and Execute the program.
⮚ Now 7 segment Displays the value 0 1 2 3.
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
9105 F0 MOVX@DPTR, A
9106 12 91 2C LCALL I2CINIT
9132 22 RET
9133 74 01 STARTC: MOV A, #-01H SCL SET
9135 F0 MOVX@DPTR, A
913C 22 RET
913D 74 00 STOP: MOV A, #00H SCL CLR
913F F0 MOVX@DPTR, A
9140 74 02 MOV A, #02H SDA CLR
9142 F0 MOVX@DPTR, A
9143 74 01 MOV A, #01H SCL SET
9145 F0 MOVX@DPTR, A
9146 74 03 MOV A, #03H SDA SET
9148 F0 MOVX@DPTR, A
9149 22 RET
914A 7F 08 SEND: MOV R7, #08H
914F E8 MOV A, R0
9150 33 RLC A
916C 22 RET
DC MOTOR INTERFACE WITH 8051
AIM:
To interface DC motor with 8051 and to run the DC motor speed.
PROGRAM:
RESULT:
Execute the program. Now we can see that the DC motor run
STEPPER MOTOR INTERFACE WITH 8051
AIM:
To interface the stepper motor with 8051 trainer kit and to run a stepper motor at different
speed in clockwise direction.
PROGRAM:
ADDRESS OPCODE MNEMONICS
9100 74 80 MOV A, #80
END
RESULT:
Execute the program. Now we can see that the stepper motor runs in forward direction
with a delay.
AIM:
To interface the stepper motor with 8051 trainer kit and to run a stepper motor for required
angle within 360 degrees.
PROGRAM:
ADDRESS OPCODE MNEMONICS
ORG 9200H
RESULT:
Execute the program. Now we can see that the stepper motor runs in forward
direction with required angle.