PC Control

PC CONTROL OF THE MINI MAX

If you don't want to invest in a processor board right away, a quick and cheap solution is to use your existing computer. The PC has a parallel port used to communicate with the printer. The standard PC parallel port has eight outputs and five inputs. In this example, three outputs are used to control the MINI MAX motors.

A DB25 cable can be purchased at most computer supply stores. Make sure this cable has all 25 conductors. Some cables only have three or so for RS232 connections only. In some cases, pins 2 and 3 are switched, this is also for RS232 connections.
PARALLEL PORT OUTPUT CONNECTIONS

DB25

BIT #

2

0

3

1

4

2

5

3

6

4

7

5

8

6

9

7





POSSIBLE PARALLEL PORT OUTPUT ADDRESS

&H3BC, &H378, &H278

PARALLEL PORT INPUT CONNECTIONS

DB25 BIT #
15 3
13 4
12 5
10 6

11

7



POSSIBLE PARALLEL PORT INPUT ADDRESS

&H3BD, &H379, &H279

The first three outputs are used to control the motors,

P0 - MOTORS ON

P1 - LEFT DIRECTION

P2 - RIGHT DIRECTION

For example, to turn left, the parallel port must be set equal to 3, to turn right the port must equal 5.

 

COMMAND PORT

STOP 0

FORWARD 1

LEFT 3

RIGHT 5

BACK 7

A quick way to test the port connections is to use LEDs and 220 ohm resistors. Connect the following circuit to each control line. These circuits do not need to be removed when the control lines are connected to the actual robot.
This example should move the robot in a rough square.

REM MINI1.BAS
REM SHOULD MOVE ROBOT IN A SQUARE
REM DATAPORT IS ONE OF THESE; &H3BC,&H378,&H278
DATAPORT=&H378
1 FOR MOVE = 1 TO 4
REM COMMAND=PORT VALUE,DELAY=TIME
READ COMMAND,DELAY
FOR I=1 TO DELAY
NEXT I
NEXT MOVE
RESTORE
GOTO 1
DATA 0,10000,1,20000,0,20000,2,15000
END

 

This example will read the commands in the data line and move the robot in a pattern.

REM MINI2.BAS
REM MINIMAX CONTROL EXAMPLE 2
dataport = &H378
MOVENUM = 7
1 FOR move = 1 TO MOVENUM
READ command, delay
IF command = 300 THEN GOSUB 10 ELSE IF command = 400 THEN GOSUB 20 ELSE GOSUB 1000
NEXT move
RESTORE
GOTO 1
END

10 REM LEFT TURN 90 DEGREES
PRINT "LEFT 90 DEGREES"
command = 1
delay = 20000
GOSUB 1000
RETURN
20 REM RIGHT TURN 90 DEGREES
PRINT "RIGHT 90 DEGREES"
command = 2
delay = 20000
GOSUB 1000
RETURN

1000 REM move
IF command = 7 THEN PRINT "BACK"
IF command = 3 THEN PRINT "HARD LEFT"
IF command = 5 THEN PRINT "HARD RIGHT"
IF command = 1 THEN PRINT "FORWARD"
IF command = 0 THEN PRINT "STOP"



OUT dataport, command
FOR I = 1 TO delay
IF INKEY$ = "q" THEN GOSUB 2000
NEXT I
RETURN
2000 command = 0
2001 delay = 1
2010 GOSUB 1000
2020 END
REM COMMAND FORM : <command #> <duration>
DATA 1,15000,3,20000,1,15000,5,20000,7,20000,1,15000,0,15000
END

PC Control - a PC parallel port mobile robot control example

Copyright 2015 - Zagros Robotics, All Rights Reserved - Please send webpage comments or corrections to webmaster@zagrosrobotics.com - Zagros Robotics,12148 Lackland Road, St. Louis, MO 63146- 7342, (314)341-1836, info@zagrosrobotics.com for answers to any questions.

Zagros Robotics, Inc
ASP.NET Shopping Cart Software