Interfacing to 8086 and programming to control stepper motor.

1. To rotate stepper motor in clock direction

Aim:

Write a program in ALP to interface stepper motor to 8086 and rotate it in clockwise direction.

Apparatus:

1. ADS-SDA-86-STA kit
2. Stepper motor interface card
3. 1 Amp Power Supply
4. Stepper Motor
5. Adapter, Keyboard, Cables, Connecting Wires Etc...

Procedure:

1. Connect 8086 kit PC using RS232 cable.
2. Connect Power supply to 8086 kit 
3. Connect 1Amp Power Supply to the Stepper Motor
4. Connect 8255 to CN4 of 8086 using 26  pin bus.
5. Keep the DIP switch in 1 & 7 on (8086kit), open TALK, and go to options select target device as 8086 and Connect.
6. Change dip switch into 1 & 5on, once reset 8086 kit.
7. Go to file →Download hex file
8. Keep the DIP switch in 1 & 7 on (8086kit)
9. G-4000(on kit keyboard), now the stepper motor will be rotating in clockwise direction

Program:

.OUTPUT 2500AD
;EQUATES
PORT_C .EQUAL FFC4H   ;PORT C ADDRESS
CTL_PORT .EQUAL FFC6H  ;CONTROL PORT ADDRESS     
CTL_BYTE .EQUAL 80H   ;CONTROL BYTE FOR C PORT = ON 
PHASE_A .EQUAL 0cH   ;BYTE TO SWTICH ON A PHASE
PHASE_B .EQUAL 06H   ;BYTE TO SWTICH ON B PHASE
PHASE_C .EQUAL 03H   ;BYTE TO SWTICH ON C PHASE
PHASE_D .EQUAL 0DH   ;BYTE TO SWTICH ON D PHASE
DSEG    SEGMENT                            
org 0000 : 3000H
DELAY_COUNT DW 0
DSEG ENDS
CSEG SEGMENT
ASSUME CS : CSEG, DS : DSEG
      ORG 0000 : 4000H
;Start of Test Program
    MOV AL, CTL_BYTE        ;8255 INITIALISATION
    MOV DX, CTL_PORT
    OUT DX, AL ;
START:
     MOV AL, PHASE_A     ;PHASE A OF BOTH MOTORS ON
    MOV DX, PORT_C
    OUT DX, AL    
      CALL DELAY1                    ;DELAY BET. SWITCHING OF PHASES
      MOV AL, PHASE_C
    MOV DX, PORT_C
     OUT DX, AL     ;PHASE B OF BOTH MOTORS ON
    CALL DELAY1                        ;DELAY BET. SWTICHING OF PHASES
      MOV AL, PHASE_B
    MOV DX, PORT_C
      OUT DX, AL     ;PHASE C OF BOTH MOTORS ON
      CALL DELAY1                    ;DELAY BET. SWTICHING OF PHASES
      MOV AL, PHASE_D
    MOV DX, PORT_C
      OUT DX, AL     ;PHASE D OF BOTH MOTORS ON
      CALL DELAY1                 ;DELAY BET. SWTCHING OF PHASES
      JMP START     ;PROGRAMS LOOPS FROM HERE

;Delay subroutine
DELAY1: MOV CX, OFFSET DELAY_COUNT
DL1: LOOP DL1
     RET
CSEG ENDS
     .END

Result:

stepper motor is interfaced to 8086 and rotated in clockwise direction.

 

2. To rotate stepper motor in anticlockwise direction.

Aim:

Write a program in ALP to interface stepper motor to 8086 and rotate it in anti-clockwise direction.

Apparatus:

1. ADS-SDA-86-STA kit
2. Stepper motor interface card
3. 1 Amp Power Supply.
4. Stepper Motor
5. Adapter, Keyboard, Cables, Connecting Wires Etc... 

Procedure :

1. Connect 8086 kit PC using RS232 cable.
2. Connect Power supply to 8086 kit 
3. Connect 1Amp Power Supply to the Stepper Motor
4. Connect 8255 to CN4 of 8086 using 26  pin bus.
5. Keep the DIP switch in 1 & 7 on (8086kit), open TALK, and go to options select target device as 8086 and Connect.
6. Change dip switch into 1 & 5on, once reset 8086 kit.
7. Go to file →Download hex file
8. Keep the DIP switch in 1 & 7 on (8086kit)
9. G-4000(on kit keyboard), now the stepper motor will be rotating in clockwise direction

Program:

.OUTPUT 2500AD
; EQUATES
PORT_C .EQUAL FFC4H; PORT C ADDRESS
CTL_PORT .EQUAL FFC6H; CONTROL PORT ADDRESS
CTL_BYTE .EQUAL 80H    ; CONTROL BYTE FOR C PORT = ON
PHASE_A .EQUAL 0CH   ; BYTE TO SWTICH ON A PHASE
PHASE_B .EQUAL 06H   ; BYTE TO SWTICH ON B PHASE
PHASE_C .EQUAL 03H   ; BYTE TO SWTICH ON C PHASE
PHASE_D .EQUAL 0DH   ;BYTE TO SWTICH ON D PHASE
DSEG SEGMENT                            
org 0000 : 3000H
DELAY_COUNT DW 0
DSEG ENDS
; In a one-phase on scheme (anti clockwise) half step
CSEG SEGMENT
ASSUME CS : CSEG, DS : DSEG
        ORG 0000 : 4000H
;Start of Test Program
      MOV AL, CTL_BYTE        ;8255 INITIALISATION
      MOV DX, CTL_PORT
      OUT DX, AL 
START: MOV AL, 77H          ;PHASE_D ;PHASE A OF BOTH MOTORS ON
       MOV DX, PORT_C
       OUT DX, AL    
       CALL DELAY1   ; DELAY BET. SWITCHING OF PHASES
       MOV AL, BBH         ;PHASE_B
       MOV DX, PORT_C
OUT DX, AL           ;PHASE B OF BOTH MOTORS ON
CALL DELAY                       ;DELAY BET. SWTICHING OF PHASES
MOV AL, DDH         ;PHASE_C
MOV DX, PORT_C
OUT DX, AL      ;PHASE C OF BOTH MOTORS ON
CALL DELAY1  ;DELAY BET. SWTICHING OF PHASES
MOV AL, EEH     ;PHASE_A
MOV DX, PORT_C
OUT DX, AL         ;PHASE D OF BOTH MOTORS ON
CALL DELAY1                 ;DELAY BET. SWTCHING OF PHASES
JMP STAR        ;PROGRAMS LOOPS FROM HERE
;Delay subroutine
DELAY1:
MOV CX, OFFSET DELAY_COUNT
DL1: LOOP DL1
  RET
CSEG    ENDS
        .END

Result:

stepper motor is interfaced to 8086 and rotated in anticlockwise direction.