beautypg.com

Measurement Computing Micro 488/EX rev.2.1 User Manual

Page 217

background image

Appendix D

Sample Programs

D.3

The following program can be used to interact directly from a PC's keyboard with

the Micro488/EX. Software Xon/Xoff handshaking is accomplished directly by the
program as Basic does not support the software handshaking. The program initalizes
the Micro488/EX to…

Use only CR for the serial output terminator.
Set a time out value of 10 seconds
Disable the ID character
Disable Error Reporting
Define a special error reporting macro which re-installs itself at execution
Installs the Error Reporting macro to execute on an error.

From then on, any keys which are typed at the keyboard are printed to the PC's

screen and set out the serial port to the Micro488/EX. Any data returned from the
Micro488/EX is printed to the PC's screen. Errors are automatically reported and
cleared.

100 '
110 ' Xon/Xoff Terminal
120 '
130 CLS
140 OPEN "com1:9600,n,8,2,ds,cd" AS 1
150 XON$ = CHR$(&H11) : XOFF$ = CHR$(&H13)
160 'set the serial output terminator to CR only
170 PRINT#1,"sterm cr"
180 ' enable a timeout of 10 seconds
190 PRINT#1,"time out 10"
200 ' disable the ID character
210 PRINT#1,"ID;"
220 ' turn error reporting off
230 PRINT#1,"error off"
240 ' define a macro to execute on error detection
250 PRINT#1,"macro 4"
260 PRINT#1,"com '";CHR$(7);"\'"
270 PRINT#1,"status1"
280 PRINT#1,"on error domacro 4"
290 PRINT#1,"endm"