8.4  RS232C Interface 
A suitable cable to connect the 2003RP AC Source to a 9 pin PC-AT style serial port is 
supplied with the source.  If you are unable to locate this cable, you need to use a cable that 
conforms to the wiring diagram shown in Figure 8-3. 
Note:  This cable is not bi-directional, so it is important to mark the PC side and the 
AC source side of this cable.  If the cable is connected in reverse, it will not 
operate correctly. 
The RP Series expects a LF (Hex 10) terminator at the end of each string sent over the 
RS232C interface.  If the programming environment you use to develop test programs does 
not append a LF terminator to each output string, the RP Series will not respond.  This is true 
of programs like LabView™ using VISA drivers. 
8.4.1  Serial Communication Test Program 
The following sample program written in Quick-BASIC can be used to check communication 
to the RP Series AC source over the RS232C serial interface. The interface is optional and 
must be installed for this to work. 
'California Instruments 2001P RS232C Communication Demo Program 
'(c) 1998 Copyright California Instruments, All Rights Reserved 
' 
'This program is for demonstration purposes only and is not to be 
'used for any commercial application 
'================================================================ 
'Function and Subroutine Declarations 
DECLARE FUNCTION retstring$ () 
 
'================================================================ 
'MAIN PROGRAM CODE 
'================================================================ 
 
'OPEN COM2. Replace with COM1, COM3 or COM4 for Com port used 
'The input and output buffers are set to 2K each although 
'this is not required for most operations. 
 
OPEN "COM2:19200,n,8,1,BIN,LF,TB2048,RB2048" FOR RANDOM AS #1 LEN = 1 
CLS 
PRINT "**** 2001P INTERACTIVE MODE ****" 
'Enter and endless loop to accept user entered commands 
DO 
  INPUT "Enter Command ('quit' to exit)--> ", cmd$ 
  IF cmd$ <> "QUIT" AND cmd$ <> "quit" THEN 
    IF cmd$ <> "" THEN 
      PRINT #1, cmd$ + CHR$(10); 
    END IF 
    IF INSTR(cmd$, "?") THEN 
      PRINT "AC Source query response = "; retstring$ 
    END IF 
    'Check for Errors after each command is issued 
    PRINT "Sending non-query syntax check *ESR?" 
    'On fast PC's we may have to hold off between commands 
    FOR t = 0 TO 1000: NEXT t 
    PRINT #1, "*ESR?" + CHR$(10); 
    esr% = 0  'Clear last error 
    'Mask off bits 5,4,3,2 only. Other bits are not used. 
    esr% = VAL(retstring$) AND 60 
    'Process esr% value for error bits 
    IF esr% AND 4 THEN 
      PRINT "*** Query Error Reported by AC Source ***"