2 / 2 6 / 2 0 0 2 2 : 0 6 P M 2 / 2 6 / 2 0 0 2
8 9
N M I L - 7 0 4 0 S T E P P E R M O T O R C O N T R O L L E R
B A S I C S A M P L E P R O G R A M
NEW
REM The NMIL-7040 stepper motor controller can be with the NMIY-0031
REM processor board to implement a stepper motor control system. This
REM program illustrates the commands used to control a stepper in such
REM a system. The program uses 0FFE0H as the address of the NMIL-7040.
REM
REM Initialize Parameters
REM No initialization of the NMIL-7040 is needed. In an actual system,
REM it may be desirable to position the motor to an initial starting
REM position.
10 DUMMY = 17 : REM Used by delay loop
20 DELAY = 4 : REM Number of times through delay loop
30 MNUMBER = 1 : REM Motor number
40 DIRECT = 1 : REM Motor direction
50 STEEPS = 10 : REM Number of steps to make in one move
60 BASEADR = 0FFE0H : REM Base address of NMIL-7040
100 PRINT " 0 Enter a motor to control (1-4, default = 1)"
110 PRINT " 1 Change motor direction (default = CW)"
120 PRINT " 2 Enter the number of steps to move"
130 PRINT " 3 Issue motor command"
140 PRINT " 4 Put motor in search mode (does not return to menu)"
150 INPUT " Enter the number of your selection: ", CHOICE
160 ON (CHOICE) GOTO 200, 210, 220, 300, 500
REM Get motor number and check range
200 INPUT "Enter a motor number (1, 2, 3, 4) to control: ", MNUMBER
205 IF ((MNUMBER < 1) .OR. (MNUMBER > 4)) THEN MNUMBER = 1 ELSE GOTO 100
REM Flip direction bit
210 DIRECT = DIRECT .XOR. 1 : GOTO 100
REM Get number of steps and check range
220 INPUT "Enter the number (positive integer) of steps to make: ", STEEPS
225 IF (STEEPS < 1) THEN STEEPS = 10 ELSE GOTO 100
REM Lines 300 to 350 use MNUMBER (motor number) and REGMASK
REM to generate the output data for controlling the selected motor.
REM DIRECT is used to set the direction of motor rotation.
300 REGMASK = 2
310 IF (MNUMBER = 1) THEN GOTO 350
320 FOR I = 2 TO MNUMBER
330 REGMASK = REGMASK * 4
340 NEXT I
350 COMMND = R ((REGMASK/2)*DIRECT)
REM Lines 360 to 420 then toggle the step line for the selected motor
REM the requested number of times. Lines 1070 and 1090 are delays.
360 FOR I = 1 TO STEEPS
370 XBY(BASEADR) = COMMND
380 FOR J = 1 TO DELAY : NEXT J
390 XBY(BASEADR) = COMMND .XOR. REGMASK
400 FOR J = 1 TO DELAY : NEXT J
410 NEXT I
420 IF (CHOICE = 4) THEN GOTO 510 ELSE GOTO 100
REM Setup for nearly 1 revolution with fast response, then loop forever
500 STEEPS = 200 : DELAY = 3
510 DIRECT = DIRECT .XOR. 01H
520 GOTO 300
Содержание NMIY-0031
Страница 1: ...2 2 6 2 0 0 2 2 0 6 P M 1 NMIY 0031 Single Board Computer Covers NMIY 0031 V1 0 4 22 96 ...
Страница 2: ...2 2 6 2 0 0 2 2 0 6 P M 2 ...
Страница 6: ...2 2 6 2 0 0 2 2 0 6 P M 6 ...
Страница 8: ...2 2 6 2 0 0 2 2 0 6 P M 8 ...
Страница 14: ...2 2 6 2 0 0 2 2 0 6 P M 1 4 ...
Страница 30: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 3 0 ...
Страница 32: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 3 2 ...
Страница 50: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 0 ...
Страница 52: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 2 ...
Страница 54: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 4 ...
Страница 56: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 6 ...
Страница 58: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 5 8 ...
Страница 60: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 6 0 ...
Страница 62: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 6 2 ...
Страница 68: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 6 8 ...
Страница 70: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 7 0 ...
Страница 72: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 7 2 ...
Страница 76: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 7 6 ...
Страница 82: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 2 ...
Страница 84: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 4 ...
Страница 86: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 6 ...
Страница 88: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 8 8 ...
Страница 90: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 9 0 ...
Страница 102: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 0 2 ...
Страница 108: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 0 8 ...
Страница 110: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 1 0 ...
Страница 114: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 1 4 ...
Страница 118: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 1 8 ...
Страница 126: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 2 6 ...
Страница 128: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 2 8 ...
Страница 134: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 3 4 ...
Страница 148: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 4 8 ...
Страница 150: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 0 ...
Страница 152: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 2 ...
Страница 154: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 4 ...
Страница 156: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 5 6 ...
Страница 168: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 6 8 ...
Страница 170: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 0 ...
Страница 172: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 2 ...
Страница 174: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 4 ...
Страница 178: ...2 2 6 2 0 0 2 2 0 6 P M 2 2 6 2 0 0 2 1 7 8 ...