0% found this document useful (0 votes)
16 views10 pages

Unit 5 IMP Points

The document discusses interfacing a stepper motor and writing assembly language programs to rotate it clockwise and anticlockwise. It also discusses developing an 8051 based traffic light controller and writing the assembly program. Finally, it discusses interfacing an LM35 temperature sensor and writing an assembly program to read the temperature.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views10 pages

Unit 5 IMP Points

The document discusses interfacing a stepper motor and writing assembly language programs to rotate it clockwise and anticlockwise. It also discusses developing an 8051 based traffic light controller and writing the assembly program. Finally, it discusses interfacing an LM35 temperature sensor and writing an assembly program to read the temperature.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1.

Draw the interfacing of stepper motor and write an ALP to rotate in


anticlockwise direction.

Half Step Sequence(0.9°)


Step A B C D A´ B´ C´ D´ HEX DECIMAL
No. CODE
1 0 0 0 0 1 0 0 0 08H 8
2 0 0 0 0 1 1 0 0 0CH 12
3 0 0 0 0 0 1 0 0 04H 4
4 0 0 0 0 0 1 1 0 06H 6
5 0 0 0 0 0 0 1 0 02H 2
6 0 0 0 0 0 0 1 1 03H 3
7 0 0 0 0 0 0 0 1 01H 1
8 0 0 0 0 1 0 0 1 09H 9

Full Step Sequence(1.8°)


Step A B C D A´ B´ C´ D´ HEX DECIMAL
No. CODE
1 0 0 0 0 1 1 0 0 0CH 12
2 0 0 0 0 0 1 1 0 06H 6
3 0 0 0 0 0 0 1 1 03H 3
4 0 0 0 0 1 0 0 1 09H 9

Program-
ORG 00H
MAIN: MOV A, #0CH
MOV P2, A
ACALL DELAY
MOV A, #06H
MOV P2, A
ACALL DELAY
MOV A, #03H
MOV P2, A
ACALL DELAY
MOV A, #09H
MOV P2, A
ACALL DELAY
SJMP MAIN
DELAY: MOV R3, #08H
UP2: MOV R2, #0FFH
UP1: MOV R1, #0FFH
HERE: DJNZ R1, HERE
DJNZ R2, UP1
DJNZ R3, UP2
RET
END

1) Full step sequence clockwise


ORG 00H
MAIN:MOV A,#0CH
MOV P2,A
ACALL DELAY
MOV A,#06H
MOV P2,A
ACALL DELAY
MOV A,#03H
MOV P2,A
ACALL DELAY
MOV A,#09H
MOV P2,A
ACALL DELAY
SJMP MAIN
DELAY:MOV R3,#08H
UP2:MOV R2,#0FFH
UP1:MOV R1,#0FFH
HERE:DJNZ R1,HERE
DJNZ R2,UP1
DJNZ R3,UP2
RET
END

2) Full step sequence Anti-clockwise


ORG 00H
MAIN:MOV A,#09H
MOV P2,A
ACALL DELAY
MOV A,#03H
MOV P2,A
ACALL DELAY
MOV A,#06H
MOV P2,A
ACALL DELAY
MOV A,#0cH
MOV P2,A
ACALL DELAY
SJMP MAIN
DELAY:MOV R3,#08H
UP2:MOV R2,#0FFH
UP1:MOV R1,#0FFH
HERE:DJNZ R1,HERE
DJNZ R2,UP1
DJNZ R3,UP2
RET
END

3) Half step sequence clockwise


ORG 00H
MAIN:MOV A,#08H
MOV P2,A
ACALL DELAY
MOV A,#0CH
MOV P2,A
ACALL DELAY
MOV A,#04H
MOV P2,A
ACALL DELAY
MOV A,#06H
MOV P2,A
ACALL DELAY
MOV A,#02H
MOV P2,A
ACALL DELAY
MOV A,#03H
MOV P2,A
ACALL DELAY
MOV A,#01H
MOV P2,A
ACALL DELAY
MOV A,#09H
MOV P2,A
ACALL DELAY
SJMP MAIN
DELAY:MOV R3,#08H
UP2:MOV R2,#0FFH
UP1:MOV R1,#0FFH
HERE:DJNZ R1,HERE
DJNZ R2,UP1
DJNZ R3,UP2
RET
END

4) Half step sequence Anti-clockwise


ORG 00H
MAIN:MOV A,#09H
MOV P2,A
ACALL DELAY
MOV A,#01H
MOV P2,A
ACALL DELAY
MOV A,#03H
MOV P2,A
ACALL DELAY
MOV A,#02H
MOV P2,A
ACALL DELAY
MOV A,#06H
MOV P2,A
ACALL DELAY
MOV A,#04H
MOV P2,A
ACALL DELAY
MOV A,#0CH
MOV P2,A
ACALL DELAY
MOV A,#08H
MOV P2,A
ACALL DELAY
SJMP MAIN
DELAY:MOV R3,#08H
UP2:MOV R2,#0FFH
UP1:MOV R1,#0FFH
HERE:DJNZ R1,HERE
DJNZ R2,UP1
DJNZ R3,UP2
RET
END
2. Develop an 8051 based system for traffic light controlling .Draw interfacing
diagram and write ALP for the same.
Process:
1. Allow traffic from W to E and E to W.
2. Yellow light ON.
3. Allow traffic from N to S and S to N
4. Yellow light ON.
5. Repeat Process

Program:
NR EQU P1.0
NY EQU P1.1
NG EQU P1.2
SR EQU P1.3
SY EQU P1.4
SG EQU P1.5
ER EQU P1.6
EY EQU P1.7
EG EQU P3.0
WR EQU P3.1
WY EQU P3.2
WG EQU P3.3
MOV P1, #00H
MOV P3, #00H
AGAIN: SETB NR; North Red ON
SETB SR; South Red ON
SETB EG; East Green ON
SETB WG; West Green ON
ACALL DELAY
CLR EG; East Green OFF
CLR WG; West Green OFF
SETB EY; East Yellow ON
SETB WY; West Yellow ON
ACALL Y_DELAY; Small Delay for Yellow
CLR EY; East Yellow OFF
CLR WY; West Yellow OFF
SETB ER; East Red ON
SETB WR; West Red ON
CLR SR; South Red OFF
CLR NR; North Red OFF
SETB NG; North Green ON
SETB SG; South Green ON
ACALL DELAY
CLR NG; North Green OFF
CLR SG; South Green OFF
SETB NY; North Yellow ON
SETB SY; South Yellow ON
ACALL Y_DELAY
CLR NY; North Yellow OFF
CLR SY; South Yellow OFF
CLR ER; East Red OFF
CLR WR; West Red OFF
AJMP AGAIN
DELAY: MOV R0, #0FFH
L: MOV R1, #0FFH
DJNZ R1, $
DJNZ R0, L
RET
Y_DELAY: MOV R2, #0FFH
DJNZ R2, $
RET
END
3. Develop an ALP to read temperature from LM35 sensor. Draw the interfacing diagram
with 8051

Program:
ADDR_A BIT P3.3
ADDR_B BIT P3.1
ADDR_C BIT P3.0
SC BIT P3.6
ALE BIT P3.4
OE BIT P3.5
EOC BIT P3.7
MY_DATA EQU P1
ORG 0000H
MOV MY_DATA, #0FFH; make P1 as input
MOV P2, #00H; P2 as output
SETB EOC; make EOC an input
CLR ALE; clear ALE
CLR SC; clear SC
CLR OE; clear OE
CLR ADDR_C; C=0
SETB ADDR_B; B=1
CLR ADDR_A; A=0(select channel 2)
ACALL DELAY
SETB ALE; latch address
ACALL DELAY
BACK: SETB SC; start conversion
ACALL DELAY
CLR ALE
CLR SC
HERE: JB EOC, HERE; wait
HERE1: JNB EOC, HERE1
SETB OE
ACALL DELAY
MOV A, MY_DATA; Read temperature
MOV P2, A; display temperature
CLR OE
SJMP BACK
DELAY: MOV R3, #25; Delay Subroutine
L3: MOV R4, #100
L2: MOV R5, #100
L1: DJNZ R5, L1
DJNZ R4, L2
DJNZ R3, L3
RET
END

You might also like