
1 '
2'
3'
Single-Axis
Control
Single-Axis
Interface
Program
Example
AX.
BAS PROGRAM
CHAPTER 4. APPLICATION DESIGN
69
The
AX
system
is
capable
of single
and
multiple
axis
applications.
The
principles developed for a single-axis
system
apply
as
well
to
multi-axis
systems.
If
you
already
have
BASICA
or
GW
BASIC programming
languages
on
your
computer, you
may
use
the
following
sample
program
designed
to
open
a serial
communication
port
and
send
and
receive
AX
commands.
The
program
performs
the
following
steps:
• Executes
the
first move
upon
user
input
• Watts for a line feed from
the
AX
,
which
indicates
the
end
of
the
move.
• Upon
user
input, executes
the
second move
• Watts for a line feed from
the
AX,
which
indicates
the
end
of
the
move. It
then
begins
the
process
again.
This
application
can
be
looked
on
as
moving a
part
out,
machining
the
part,
then
bringing
the
part
back.
*********.********
••••
**.******
•••
*****
•••
******************
4 ' *
5 ' * This program controls the RS232 Communication line
to
execute 2
6 '
* different moves using the
AX
7 ' *
8 ' *
*
*
****.**********************
•••
**
••
**.********.*
•••••
***.****
15
OPEN
"COM1
:9600,N,8, 1 ,RS,CS,DS,CD"
AS
#1
' Open Communication port
20
V$
=
"":
0$
=
"":
ECHO$ =
"":
LF$ =
"":
' Initialize variables
90
CLS
100 LOCATE 12,15
105
PRINT"
PRESS
ANY
KEY
TO
START
THE
PROGRAM"
107
V$
= INKEY$:
IF
LEN(V$) = 0
THEN
100 ' Wait for input from user
120
Z$
= "Z" '.Reset the
AX
indexer
122
PRINT #1,Z$;
124
0$
= INPUT$(2,1)
900
'
****************
•••
***.*.*****
••
****
••••••••
*.******
••
****
901
' *
902
903
' *
904 ' *
905
906
' *
Line 1000-1060 sends a move down to the first
AX.
Computer
waits for the Une
Feed from the
AX
indicating that the motor
has finished its move. Computer will not command second
AX
to move
*
*
*
*
* • • • * * * * * * • * * * * * * * * • * * • • • • • • * * • • • • • • • * * * • * • • • * • * • • • • • * * * * •
Commentaires sur ces manuels