Saturday, 16 August 2014

Stepper Motor Interface in 8086

;8086 Interfaced with 8255 PPI and Stepper Motor in Full Step Mode     
      OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
LIST DB 05H,09H,0AH,06H
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
L2:
        MOV SI,OFFSET LIST
        MOV CL,04H
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
L1:
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        CALL DELAY   
        INC SI
        DEC CL
        JNZ L1
        JMP L2
DELAY:

        MOV BX,2200H
L3:
        DEC BX
        JNZ L3
        RET

CODE ENDS
END

;8086 Interfaced with 8255 PPI and Stepper Motor in Half Step Mode
      OUTPUT 2500AD
.ORG 2000H

DATA SEGMENT
LIST DB 05H,01H,09H,08H,0AH,02H,06H,04H
DATA ENDS

CODE SEGMENT
    ASSUME CS:CODE,DS:DATA
START:
        MOV AX,DATA
        MOV DS,AX
        MOV AL,80H
        MOV DX,FFE6H
        OUT DX,AL
        MOV CH,19H
L2:
        MOV SI,OFFSET LIST
        MOV CL,08H
L1:
        MOV AL,[SI]
        MOV DX,FFE0H
        OUT DX,AL
        CALL DELAY
        INC SI
        DEC CL
        JNZ L1
        DEC CH
        JNZ L2
        JMP LAST

DELAY:
        MOV BX,2200H
L3:
        DEC BX
        JNZ L3
        RET
LAST:
CODE ENDS
END

1 comment: