DC Motor

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

DC MOTOR

AIM:
DC motor interface with 8086
Apparatus: serial cable, GSAS 86/88E kit, a DC motor interface kit, power
supplying wires.
Proedure:
1. An interface connector must be connected to J7 of the trainer(GSAS 86/88) from
the DC motor device.
2. Give the power supply to the DC motor from adaptor.
3. Connect all the connections carefully as shown in the figure.

Assembly Language Program:

ADDRESS LABELS MNEMONICS COMMENTS


2000 MOV AX,0000
2003 MOV CX,AX
2005 MOV AL,83 Initialize port-A
output and port-B
input
2007 MOV DX,0FFE6
200A OUT DX,AL
200B MOV BL,7F
200D SETSPD MOV AL,BL Run the motor at
half speed
200F MOV DX,0FFE0
2012 OUT DX,AL
2013 MOV AX,00FF
2016 LOOP CALLS 0FE00:00B8
201B CMP AL,49 Check for I
201D JNE CHECK_D
201F CMP BL,1F If current speed
less than high
speed increase
speed
2022 JNE INCREASE
2024 JMP LOOP
2026 CHECK_D CMP AL,44 Check for D
2028 JNE CHECKSPD
202A CMP BL,0D If current speed
greater than low
speed decrease
speed
202D JNE DECREASE
202F JMP LOOP
2031 CHECKSPD CMP AL,53 Check for s
2033 JNE LOOP
2035 JMP SPEED Jump to speed and
check for increase
speed or decrease
speed
2037 INCREASE DEC BL
2039 JMP SETSPD
203B DECREASE INC BL
203D JMP SETSPD
203F SPEED MOV BH,00 Call to display
speed
2041 MOV CL,00
2043 MOV CH,00
2045 MOV DX,0FFE2 Load port-B
address
2048 ISPB1LOW IN AL,DX
2049 AND AL,02
204B CMP AL,00
204D JNE ISPB1LOW Ispb1low?
204F ISPB1HIGH IN AL,DX
2050 AND AL,02
2052 CMP AL,02
2054 JNE ISPB1HIGH Ispb1high?
2056 ISPB0LOW IN AL,DX
2057 AND AL,01
2059 CMP AL,01
205B JNE ISPB0LOW Ispb1low? Count
pulses
205D INC BH
205F CALL DELAY
2062 ISPB0HIGH IN AL,DX
2063 AND AL,01
2065 CMP AL,00
2067 JNE ISPB0HIGH Loop if pb0high
2069 CALL DELAY
206C IN AL,DX
206D AND AL,02
206F CMP AL,00
2071 JNE ISPB0LOW Continue if time
pulse is still high
2073 MOV AL,BH
2075 MOV CH,00
2077 MOV CL,00
2079 PUSH AX
207A MOV AX,0000
207D MOV ES,AX
207F MOV AX,2100 Load msg address
2082 CALLS 0FE00:0013
2087 POP AX Convert count to
BCD then to ASCII
2088 CALL HEXTOBCD
208B MOV AL,CH Put the char on to
console
208D CALLS 0FE00:0000
2092 MOV AL,CL
2094 CALLS 0FE00:0000
2099 MOV AL,0D
209B CALLS 0FE00:0000
20A0 MOV AL,0A
20A2 CALLS 0FE00:0000
20A7 JMP LOOP
20AA HEXTOBCD MOV CL,00 HEX to BCD
conversion
20AC MOV CH,00
20AE BACK SUB AL,0A
20B0 JC NEXT
20B2 INC CH
20B4 JMP BACK
20B6 NEXT ADD AL,0A
20B8 MOV CL,AL
20BA OR CH,30
20BD OR CL,30
20C0 RET
20C1 DELAY MOV SI,0FF
20C4 D1 DEC SI
20C5 JNE D1
20C7 RET

Inputs:
Inputs were given in the memory location 2000.

OUTPUT: MOTOR ROTATES

You might also like