Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Salman Tariq

2012-EE-55

LAB# 08
OBJECTIVE:
Interfacing DC Motor, Stepper Motor and 7 Segment Display with 89c51.

Task 1:
>>Source code to rotate DC motor clockwise when p1.0 is high and counter-clockwise when p1.0 is low. Org 0000h Mov p1,0ffh here: Jnb p1.0,ccw setb p2.7 clr p2.6 Sjmp here ccw: setb p2.7 clr p2.6 sjmp here end \\p2.6 is connected to motor (anticlockwise) \\p2.7 is connected to motor (clockwise)

Task #2:
>>Source code to drive stepper motor using crystal of 11.0592MHz and delay of 500ms. 1) Clockwise Half Stepping 2) Clockwise Full Stepping

Page 1

Salman Tariq 1) org 0000h mov r0,#00010001 mov a,r0 xyz: mov p1,a acall delay rr a sjmp xyz delay: mov r7,#100 asd: mov r6,#100 sdf: mov r5,#23 djnz r5,$ djnz r6,sdf djnz r7,asd ret end

2012-EE-55

Page 2

Salman Tariq 2) org 0000h mov r0,#00110011 mov a,r0 xyz: mov p1,a acall delay rr a sjmp xyz delay: mov r7,#100 asd: mov r6,#100 sdf: mov r5,#23 djnz r5,$ djnz r6,sdf djnz r7,asd ret end

2012-EE-55

Task# 3:
>>Source code to control 7 segment from 0-99 with delay of 1 second and crystal of 11.0592MHz. ORG 0000h mov a , #00

Page 3

Salman Tariq here: da a mov p1 , a inc a acall delay cjne a,#99,label delay: mov r7,#100 asd: mov r6,#100 sdf: mov r5,#40 djnz r5,$ djnz r6,sdf djnz r7,asd ret end

2012-EE-55

Task 4:
>> Source code to make a digital clock on 7 segment using port 1 and 2. org 0000h mov r0,#00 mov r1,#00 xyz: cjne r1,#60,here

Page 4

Salman Tariq mov a,#00 inc r0 mov a,r0 mov p2,a sjmp xyz here: mov a,r1 mov p1,a acall delay inc r1 sjmp xyz delay: mov r7,#100 asd: mov r6,#100 sdf: mov r5,#40 djnz r5,$ djnz r6,sdf djnz r7,asd ret end

2012-EE-55

Page 5

You might also like