CY545 Stepper System Controller
www.ControlChips.com
© 2002 Cybernetic Micro Systems
Chapter 20 - Getting Your CY545 Running
99
BASIC Language CRT Emulation Program
The following BASIC language program emulates a CRT for direct serial communications with
the CY545A. It starts by sending the two carriage returns to set the CY545 baud rate. It then
sends the Mode command to enable the CTS/ signal. These are both done with CTS monitoring
disabled. The host serial port id then reconfigured to enable the CTS monitoring function, and all
other commands use CTS/. The program is a simple terminal emulator, which takes any
command entered from the keyboard and sends it to the CY545, while also displaying any serial
data sent by the CY545.
100 ' BASIC Language
110 ' CRT EMULATOR FOR CY545A
120 ' Cybernetic Micro Systems, Inc.
130 '
140 ' This program configures the CY545A for serial commands,
150 ' by sending two carriage returns to set the adaptive
160 ' rate, then sending a Mode command to enable the Clear
170 ' To Send signal. After this, the program redefines the
180 ' computer serial port to function with the CTS signal.
190 ' It then becomes a terminal emulator, waiting for keyboard
200 ' input, which it displays on the screen and sends to the
210 ' CY545A, while displaying all serial characters received
220 ' from the CY545A.
230 '
300 CLS
310 LF$=CHR$(10) : CR$=CHR$(13) : NL$=CHR$(0) : ES$=CHR$(27)
320 '
330 ' Open the COM1 serial port at 9600 baud, no parity
340 ' Note that CTS is disabled during this part
350 '
360 OPEN "COM1:9600,N,8,1,CS0,DS0,CD0" AS #1
370 '
380 ' Send two carriage returns to adapt the CY545A baud rate
390 '
400 PRINT #1,CR$;CR$
410 '
420 ' Send the Mode command to turn on the CY545A CTS signal
430 '
440 PRINT #1,"O 0A0h";CR$
450 FOR I% = 1 to 5000 'Delay while Mode Command is sent
460 NEXT I%
470 '
480 ' Now reconfigure COM1 to use CTS
490 '
500 CLOSE #1
510 OPEN "COM1:9600,N,8,1,CS30000,DS0,CD0" AS #1
520 LOCATE 5,5,1
530 PRINT "Ready to Go!"
540 '
550 ' Open the screen for displays
560 '
570 OPEN "SCRN:" FOR OUTPUT AS #2
600 '
610 ' Check for keyboard input. Display and send any