Appendix g - basic language terminal emulation – KEPCO BIT 232F User Manual
Page 69

BIT 232 2/28/00
G-1
APPENDIX G - BASIC LANGUAGE TERMINAL EMULATION
G.1
INTRODUCTION
This appendix presents a program written in BASIC language intended to aid the user in build-
ing BASIC language test programs using the BIT Card. (See PAR. 1.4 to order Sample Pro-
grams diskette.)
The BASIC Language Terminal Emulation program performs a series of commands, then allows
the user to type commands and control a BOP via the BIT Card from a keyboard. The keyboard
commands are displayed on the screen while the commands are executed and response mes-
sages are displayed on the screen.
SCPI commands are used, however the program may easily be modified to use CIIL commands
by changing the applicable character strings.
The program is written to use COM port 2; to use COM port 1 change the following line:
OPEN “COM2:9600,N,8,1,RS,CS,DS” FOR RANDOM AS #1 LEN = 256
to:
OPEN “COM1:9600,N,8,1,RS,CS,DS” FOR RANDOM AS #1 LEN = 256
With the program loaded under a BASIC interpreter, press ALT+R to run the program or ALT+Q
to exit.
The program performs the following functions
1. Request power supply identification (*IDN?).
2. Reset the power supply (*RST).
3. Test the power supply (*TST).
4. Check for errors (SYST:ERR)
5. Wait for keyboard commands. When keyboard commands are entered, the echoed com-
mands and response messages are displayed.
DEFINT A-Z
DECLARE SUB SendWecho (SendChar$)
DECLARE SUB SendCommand (SendCmmd$)
DECLARE SUB SendCmmdWready (SendCmd$)
DECLARE SUB Filter (InString$)
CONST FALSE = 0, TRUE = NOT FALSE
COLOR 7, 1 ‘ Set screen color.
CLS
Quit$ = CHR$(0) + CHR$(16) ‘ Value returned by INKEY$
‘ when ALT+q is pressed.
‘ Set up prompt on bottom line of screen and turn cursor on:
LOCATE 24, 1, 1
PRINT STRING$(80, “_”);
LOCATE 25, 1
PRINT TAB(30); “Press ALT+q to quit”;