Radio Shack Armatron on PC parallel port

Revision as of 02:19, 13 August 2019 by Netfreak (talk | contribs) (Created page with "<pre> Newsgroups: comp.robotics From [email protected] (Steve Schoeneman) Subject: RS Armitron Date: Wed, 8 Jun 1994 22:43:14 GMT Here is an interface to allow you to hook up...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Newsgroups: comp.robotics
From [email protected] (Steve Schoeneman)
Subject: RS Armitron
Date: Wed, 8 Jun 1994 22:43:14 GMT

Here is an interface to allow you to hook up a
Radio Shack Armatron to the parallel port on a
PC. This assumes that the Armatron is of the
variety with the separate motors and not the
one central motor.

I've also included a small program in C that
will allow some basic control.
The code compiles correctly on the Borland C++
compiler and has a lot of room for improvment,
but it should give you some ideas on what can be
done.

Steve Schoeneman
[email protected]
----------------------------------------------
               +5v
Printer Port   |
DB25       ____16
9-------14|      |15----PB7
8-------13|      |12----PB6
7-------11|      |10----PB5
6--------3|      |2-----PB4
5--------4|      |5-----PB3
4--------6|______|7-----PB2
            9 1 8
            | | |
1---+-------+ |===
10--+  +----| + =
16-----+    | |  +-- +5v
            9_1_16
3--------14|      |15----PB1
2---------3|      |2-----PB0
       +-13|      |
       +-11|      |
       +--4|      |
       +--6|______|
       |        8
      ===       |
       =       ===
   +5v          =
13--+
15--+

11--+
12--+
18--+
    |
   ===
    =

ICs: 14174 Hex Latch
'+' = connection

Printer Port Connections:
1. -Strobe
2. +Data0
3. +Data1
4. +Data2
5. +Data3
6. +Data4
7. +Data5
8. +Data6
9. +Data7
10. -Ack
11. +Busy
12. +Paperout
13. +Selected
14. -Auto LF
15. -Error
16. -Init
17. -Select
18. Ground
19. Ground
20. Ground
21. Ground
22. Ground
23. Ground
24. Ground
25. Ground

Relay Board

--------------+ +------------- Black (-)
+5v           | | --+
              |  ^  |
       |/-------C   |
-/\/\- |\     | C   |
PB6      |    +-C   |
        ===   |     |
         =    |     |
              | +------------- Brown (+)
              | | --+
              |  ^  |
       |/-------C   |
-/\/\- |\     | C   |
PB5      |    +-C   |
        ===   |     |
         =    |     |
              | +------------- Red
              | | --+
              |  ^  |
       |/-------C   |
-/\/\- |\     | C   |
PB4      |    +-C   |
        ===   |     |
         =    |     |
              |  V------------ Orange
              |   --+
              |  ^  |
       |/-------C   |
-/\/\- |\     | C   |
PB3      |    +-C   |
        ===   |     |
         =    |     |
              |  V--+
              |   --|--------- Yellow
              |  ^--|------------------
       |/-------C   |                 |
-/\/\- |\     | C   |                 |
PB2      |    +-C   |                 |
        ===   |     |                 |
         =    |     |                 |
              |  V--+                 |
              |   --|--------- Green  |
              |  ^--|------------------
       |/-------C   |                 |
-/\/\- |\     | C   |                 |
PB1      |    +-C   |                 |
        ===   |     |                 |
         =    |     |                 |
              |  V--+                 |
              |   --|--------- Blue   |
              |  ^- |                 |
       |/-------C   |                 |
-/\/\- |\     | C   |                 |
PB0      |    +-C   |                 |
        ===   |     |                 | V
         =    |     |                 | ----- Black (-)
--| Gnd       +---------------------+ +-^
 ===                            +-----C
  =           ---/\/\-|/--------+   | C
             PB7      |\            +-C
                        |
                       ===
                        =

Resistors:   10K
Relays:      5 volt, 250 ohm reed (spst)
Transistors: 2N222

Armatron wiring:
Black - Negative (reversing voltage)
Brown - Positive (forward voltage)
Yellow - Left Drive Motor
Green - Right Drive Motor
Blue - Arm (up/down)
Orange - Wrist (up/down)
Red - Wrist Turn/Manipulator Clamp

C Code - cut here
-----------------------------------------------------------

/* ----------------------------------- */
/*        Armatron Robotic Arm         */
/*            Controller               */
/*                                     */
/*     Written by Steve Schoeneman     */
/*             Version 1.2             */
/*                                     */
/*         (C) copyright 1992          */
/* ----------------------------------- */

/* ----------------------------------- */
/*          Include Files              */
/* ----------------------------------- */

#include
#include
#include
#pragma inline

/* ----------------------------------- */
/*            Definitions              */
/* ----------------------------------- */

#define FORWARD 0x30
#define REVERSE 0xC0
#define RIGHT 0xA0
#define LEFT 0x50
#define A_DOWN 0x09
#define A_UP 0x01
#define W_DOWN 0x0A
#define W_UP 0x02
#define F_CLAMP 0x0C
#define W_TURN 0x04
#define CLEAR 0x00

/* ----------------------------------- */
/*        Function Prototypes          */
/* ----------------------------------- */

void mvmnt( int mv, int port );
void mv_tim( int mv, int port, int tim );
void display(int x, int y, char * string);
int get_port( void );

void main()
{
        int ky;
        int tim;
        int port;
        port = get_port();
        clrscr();
        display(15,5, "Use the cursor keys to control the Armatron Base.");
        display(15,6, "-------------------------------------------------");

        while( (ky = getch() ) != '\r' )
        {
                switch( ky )
                {
                        case 0x48:
                                display(35,10, "Forward     " );
                                mvmnt(FORWARD, port);
                                break;
                        case 0x50:
                                display(35,10, "Reverse     " );
                                mvmnt(REVERSE, port);
                                break;
                        case 0x4D:
                                display(35,10, "Right Turn  " );
                                mvmnt(RIGHT, port);
                                break;
                        case 0x4B:
                                display(35,10, "Left Turn   " );
                                mvmnt(LEFT, port);
                                break;
                        case 0x51:
                                display(35,10, "Arm Down    " );
                                mvmnt(A_DOWN, port);
                                break;
                        case 0x49:
                                display(35,10, "Arm Up      " );
                                mvmnt(A_UP, port);
                                break;
                        case 0x4F:
                                display(35,10, "Wrist Down  " );
                                mvmnt(W_DOWN, port);
                                break;
                        case 0x47:
                                display(35,10, "Wrist Up    " );
                                mvmnt(W_UP, port);
                                break;
                        case 0x53:
                                display(35,10, "Finger Clamp" );
                                mvmnt(F_CLAMP, port);
                                break;
                        case 0x52:
                                display(35,10, "Wrist Turn  " );
                                mvmnt(W_TURN, port);
                                break;
                        case 0x20:
                                display(35,10, "Clear       " );
                                mvmnt(CLEAR, port);
                                break;
                        case 0x3B:
                                display(35,10, "F1 Forward 5" );
                                mv_tim( FORWARD, port, 5 );
                                break;
                        default:
                                break;
                }
        }

}

/* ---------------------------------- */
/*        Function Declarations       */
/* ---------------------------------- */

void mvmnt( int mv, int port )
{
        asm {
                mov dx, port   /* 0000=LPT1, 0001=LPT2... */
                mov ah, 00
                mov al, mv
                int 17h
        }
        return;
}

void mv_tim( int mv, int port, int tim )
{
        int count;
        count = 0;
        asm {
                mov dx, port
                mov ah, 00
                mov al, mv
                int 17h
        }
        while( count < (364*tim))
        {
                display(35,20, "moving forward..." );
                ++count;
        }
        asm {
                mov dx, port
                mov ah, 00
                mov al ,00
                int 17h
        }
        display(35,20, "                  " );
        return;
}

void display(int x, int y, char * string)
{
        gotoxy(x,y);
        cprintf(string);
}

int get_port( void )
{
        int pick;
        printf( "\nTo which parallel port is the Armatron connected?\n(1=LPT1, 2=LPT2, 3=LPT3)" );
        pick=getche();
        switch( pick )
        {
                case '1':
                        return 0;
                case '2':
                        return 1;
                case '3':
                        return 2;
                }
}