User guide
Chapter 4. User Interface Options
143
Host Computer Interface
Another choice for a user interface is to use a host computer and execute a motion program
using the RS-232C serial interface. A host computer may be used to run a motion program
interactively from a BASIC or C program (high-level program controls the 6000 product and
acts as a user interface). A BASIC program example (for the 6250 product) is provided below.
10 ' 6000 Series Serial Communication BASIC Routine
12 ' 6000.BAS
14 '
16 ' **************************************************************
18 '
20 ' This program will set the communications parameters for the
22 ' serial port on a PC to communicate with a 6000 series
24 ' stand-alone product.
26 '
28 ' **************************************************************
30 '
100 '*** open com port 1 at 9600 baud, no parity, 8 data bits, 1 stop bit
110 '*** activate Request to Send (RS), suppress Clear to Send (CS), suppress
120 '*** DATA set ready (DS), and suppress Carrier Detect (CD) ***
130 OPEN "COM1:9600,N,8,1,RS,CS,DS,CD" FOR RANDOM AS #1
140 '
150 '*** initialize variables ***
160 MOVE$ = "" ' *** commands to be sent to the product ***
170 RESPONSE$ = "" ' *** response from the product ***
180 POSITION$ = "" ' *** feedback position reported ***
190 SETUP$ = "" ' *** setup commands ***
200 '
210 '*** format the screen and wait for the user to start the program ***
220 CLS : LOCATE 12, 20
230 PRINT "Press any key to start the program"
240 '
250 '*** wait for the user to press a key ***
260 PRESS$ = INKEY$
270 IF PRESS$ = "" THEN 260
280 CLS
290 '
300 '*** set a pre-defined move to make ***
310 SETUP$ = "ECHO1:ERRLVL0:LH0,0:"
320 MOVE$ = "A100,100:V2,2:D50000,50000:GO11:TFB:"
330 '
340 '
400 '*** send the commands to the product ***
410 PRINT #1, SETUP$
420 PRINT #1, MOVE$
430 '
500 '*** read the response from the TFB command ***
510 ' *** the controller will send a leading "+" or "-" in response to the TFB command to
520 ' *** indicate which direction travel has occurred. ***
530 WHILE (RESPONSE$ <> "+" AND RESPONSE$ <> "-") ' *** this loop waits for the "+"
540 RESPONSE$ = INPUT$(1, #1) ' *** or "-" characters to be returned
550 WEND ' *** before reading the position ***
560 '
570 WHILE (RESPONSE$ <> CHR$(13)) ' *** this loop reads one character at a time
580 POSITION$ = POSITION$ + RESPONSE$ ' *** from the serial buffer until a carriage
590 RESPONSE$ = INPUT$(1, #1) ' *** return is encountered ***
600 WEND
610 '
620 '*** print the response to the screen ***
630 LOCATE 12, 20: PRINT "Position is " + POSITION$
640 '
650 'END










