Appendix e - rs232 command loop program – KEPCO BIT 232F User Manual
Page 61

BIT 232 022800
E-1
APPENDIX E - RS232 COMMAND LOOP PROGRAM
E.1
INTRODUCTION
This appendix is a C language program used with an IBM-PC-compatible computer running a
terminal emulation program to set up a command loop. Refer to Appendix F for all function pro-
totypes. (See PAR. 1.4 to order Sample Programs diskette.)
To modify this program for computers other that IBM-PC-compatible (e.g., Macintosh), four
ROM BIOS routines must be replaced with their equivalent (see Table E-1).
The Command Loop program performs the following functions
1. Interrogates the power supply (SCPI command VOLT?MAX) to determine the maximum volt-
age of the BOP (XXX).
2. Sets the voltage to full scale, current to 0.5A (VOLT XXX;CURR 0.5).
3. Reads the voltage and current (MEAS:VOLT?CURR?) and displays it on the computer mon-
itor.
4. Sets voltage to minus full scale, current to 0.5A (VOLT –XXX;CURR 0.5).
5. Reads the voltage and current (MEAS:VOLT?CURR?) and displays it on the monitor.
6. Sends a reset command (*RST).
7. Reads the voltage and current (MEAS:VOLT?CURR?) and displays it on the monitor.
8. Sends a test command (*TST?).
9. Reads the voltage and current (MEAS:VOLT?CURR?) and displays it on the monitor.
10.Checks for errors (SYST:ERR?); the message: 0. “No Error” is displayed on the monitor.
11. The program continuously cycles through steps 1 through 10 above; to exit the program
press ALT+Q.
This program can be set to run on either COM 1 or COM 2; for convenience it is recommended
that the user create two separate programs, one for COM1, one for COM 2.
TABLE E-1. ROM BIOS ROUTINES TO BE REPLACED WITH EQUIVALENT
FOR NON-IBM-PC-COMPATIBLE PC’S
ROM BIOS ROUTINE
FUNCTION
open_port(n) n=0 for COM1 or n=1 for COM 2
Initialize the serial port.
put_serc(n,c)
Write the character c to COM 1 or COM 2 serial port.
get_serc(n)
Read a character from the serial port.
in_ready(n)
Fetch the current status of the serial port.