REMOTE CONTROL AND PROGRAMMING REFERENCE for the FLUKE 43 family Power Quality Analyzers ============================================================= This file contains remote control and programming information for the above-mentioned models with use of the PM9080 Optically Isolated RS232 Adapter/Cable. It consists of the following chapters: 1. INSTALLING THE PM9080 2. INTRODUCTION TO PROGRAMMING 3.
Page 1.1 ============================================================= 1. INSTALLATION OF THE PM9080 - Connect the PM9080 to the RS232 port of the computer. If necessary, use a 9-pin to 25-pin adapter and 25-pin gender changer. - Hook the PM9080 cable to the Power Quality Analyzer. - Turn on the computer and the Power Quality Analyzer. - Make sure that the communication settings match for the RS232 port of the computer and the Power Quality Analyzer.
Page 2.1 ============================================================= 2. INTRODUCTION TO PROGRAMMING ** Basic Programming Information ** When you have installed the PM9080 as described in the previous chapter, you can control the Power Quality Analyzer from the computer with simple communication facilities, such as GWBASIC, QuickBASIC and QBASIC (programming languages from Microsoft Corporation). All examples given in this manual are in the QBASIC language but will also run in QuickBASIC.
Page 2.2 ** Commands sent to the Power Quality Analyzer ** All commands for the Power Quality Analyzer consist of a header made up of two alpha characters sometimes followed by parameters. Example: RI This is the Reset Instrument command. It resets the Power Quality Analyzer. Some of the commands are followed by one or more parameters to give the Power Quality Analyzer more information. Example: SS 8 This is the Save Setup command. It saves the present acquisition settings in memory.
Page 2.3 ** Responses received from the Power Quality Analyzer ** After each command sent to the Power Quality Analyzer there is an automatic response from it, indicated as (which you MUST input), to let the computer know whether or not the received command has been successfully executed. Refer to the ’Acknowledge’ section below. There are several commands that ask the Power Quality Analyzer for response data. Such commands are called Queries.
Page 2.4 ** Acknowledge ** After receiving of a command, the Power Quality Analyzer automatically returns the response to let the computer know whether or not the received command has been successfully executed. This response is a one-digit number followed by as response terminator. If is 0, it indicates that the Power Quality Analyzer has successfully executed the command.
Page 2.5 ** Data Separators ** Data Separators are used between parameters sent to the instrument and between values and strings received from the instrument.
Page 2.6 ** Command and Response Terminators ** (Message Terminators) - Command (Program Message) Terminators A code is needed at the end of each command to tell the instrument that the command is ended, and that it can start executing the command. This code is called the Program Message Terminator. The code needed for the instrument is carriage return (ASCII code 13 decimal). Notes: 1. The carriage return code is a non-visible ASCII character.
Page 2.7 ** Typical program sequence ** An example A typical program sequence consists of the following user actions: 1. Set the communication parameters for the RS232 port of the computer to match the instrument settings. 2. Output a command or query to the instrument. 3. Input the acknowledge response from the instrument. If the response value is zero, go to step 4. If the response value is non-zero, the instrument did not execute the previous command.
Page 2.8 ’Example of a typical program sequence: ’***************** Begin example program **************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 ’This QBASIC program line sets the parameters for the ’RS232 port (COM1 on the Computer) to match the ’instrument power-on default settings. It also opens a ’communication channel (assigned #1) for input or output ’through the COM1 port. Your instrument must be connected ’to this port.
’ Page 2.9 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
Page 3.1 ============================================================= 3. COMMAND REFERENCE CONVENTIONS ** Page layout used for each command ** - Header Each command description starts on a new page with a header for quickly finding the command. This header indicates the command name and the two-character header used for the command syntax.
Page 3.2 Use an MS-DOS Editor and copy the complete program between these two lines to a file name with the .BAS extension. Start QBASIC and open this file from the FILE menu. Long programs (longer than 55 lines) include page breaks. Such page breaks are preceded by the ’ (remark) character to prevent the QBASIC interpreter from interpreting them as an incorrect statement.
Page 3.3 ** Syntax conventions ** The Command Syntax and the Response Syntax may contain the following meta symbols and data elements: UPPERCASE These characters are part of the syntax. For commands, lower case is also allowed. <...> An expression between these brackets is a code, such as (carriage return) that can not be expressed in a printable character, or it is a parameter that is further specified. Do not insert the brackets in the command! [...] The item between these brackets is optional.
Page 3.4 ============================================================= ** Overview of commands for the Power Quality Analyzer ** COMMAND PAGE COMMAND NAME HEADER NUMBER ------------------------------------------------------AUTO SETUP AS 3.5 ARM TRIGGER AT 3.7 CLEAR MEMORY CM 3.9 CPL VERSION QUERY CV 3.11 DEFAULT SETUP DS 3.13 GET DOWN GD 3.15 GO TO LOCAL GL 3.17 GO TO REMOTE GR 3.20 HOLD HO 3.21 IDENTIFICATION ID 3.23 INSTRUMENT STATUS IS 3.25 PROGRAM COMMUNICATION PC 3.28 PROGRAM SETUP PS 3.
Page 3.5 ============================================================= AUTO SETUP AS ------------------------------------------------------------Purpose: Invokes an automatic setup for the active mode. The result of this command is the same as pressing the AUTO key on the instrument. Note: You can select the items that are affected by the AUTO SET procedure via the USER OPTIONS key on the instrument.
’ ’***************** Page 3.6 Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "AS" ’Sends AUTO SETUP command. GOSUB Acknowledge ’Input acknowledge from instrument. CLOSE #1 END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument.
Page 3.7 ============================================================= ARM TRIGGER AT ------------------------------------------------------------Purpose: Resets and arms the trigger system for a new acquisition. This command is used for single shot measurements. When the AT command is given while an acquisition is in progress, this acquisition is aborted and the trigger system is rearmed.
’ Page 3.8 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
Page 3.9 ============================================================= CLEAR MEMORY CM ------------------------------------------------------------Purpose: Clears all saved setups, waveforms, and screens from memory.
’ ’***************** Page 3.10 Begin example program ***************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1,"CM" ’Sends the Clear Memory command. GOSUB Acknowledge ’Input acknowledge from instrument. CLOSE #1 END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument.
Page 3.11 ============================================================= CPL VERSION QUERY CV ------------------------------------------------------------Purpose: Queries the CPL interface version. Command Syntax: CV Response Syntax: [] where, Example: is an ASCII string representing the year this version has been created.
’ ’***************** Page 3.12 Begin example program ***************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1,"CV" ’Sends CPL VERSION query. GOSUB Acknowledge ’Input acknowledge from instrument. INPUT #1,VERSION$ ’Inputs queried data. PRINT "CPL Version "; VERSION$ ’Displays version data. END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument.
Page 3.13 ============================================================= DEFAULT SETUP DS ------------------------------------------------------------Purpose: Resets the instrument to the factory settings at delivery, except for the RS232 communication settings such as baud rate, to keep the communication alive. A Master Reset (refer to the Users Manual) performs the same, but also resets the RS232 communication settings to the default values.
’ ’***************** Page 3.14 Begin example program ***************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 CLS PRINT #1, "DS" ’Sends DEFAULT SETUP command. GOSUB Acknowledge ’Input acknowledge from instrument. SLEEP 2 ’Delay (2 s) necessary after "DS". PRINT #1, "ID" ’Sends the IDENTIFICATION query. GOSUB Acknowledge ’Input acknowledge from instrument. INPUT #1, ID$ ’Inputs identity data from instrument. PRINT ID$ ’Displays identity data.
Page 3.15 ============================================================= GET DOWN GD ------------------------------------------------------------Purpose: Switches the instrument’s power off. If a power adapter is connected, you can use the SO command to switch power on again. If there is no power adapter connected, the instrument can only be switched on manually by pressing the Power ON/OFF key.
’ ’***************** Page 3.16 Begin example program ***************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 CLS PRINT #1, "GD" ’Sends the GET DOWN command. GOSUB Acknowledge ’Input acknowledge from instrument. PRINT "The GET DOWN command switched the instrument off." PRINT "Press any key on the PC keyboard to switch " PRINT "the instrument on again." SLEEP PRINT #1, "SO" ’Sends the SWITCH ON command. GOSUB Acknowledge ’Input acknowledge from instrument.
Page 3.17 ============================================================= GO TO LOCAL GL ------------------------------------------------------------Purpose: Sets the instrument in the local operation mode so the keypad is enabled. Also refer to the GR (Go to Remote) command.
’ ’***************** Page 3.18 Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "GR" ’Sends GO TO REMOTE command. GOSUB Acknowledge ’Input acknowledge from instrument. PRINT "All instrument keys (except the Power ON/OFF key) PRINT "are now disabled by the GR (GO TO REMOTE) command." PRINT "Check this." PRINT PRINT "Press any key on the PC keyboard to continue." SLEEP PRINT PRINT #1, "GL" ’Sends GO TO LOCAL command.
’ Page 3.19 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
Page 3.20 ============================================================= GO TO REMOTE GR ------------------------------------------------------------Purpose: Sets the instrument in the remote operation mode so that the keypad is disabled. You can use the following methods to return to the local operation mode so that the keypad is enabled: 1. Sending the GL (Go to Local) command. Command Syntax: GR Response Syntax: See an example for this command under GO TO LOCAL (GL).
Page 3.21 ============================================================= HOLD HO ------------------------------------------------------------Purpose: Sets the instrument in the Hold mode. In other words, the instrument stops sampling the input channels and calculating measurement results.
’ ’***************** Page 3.22 Begin example program ***************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 CLS PRINT #1, "HO" ’Sends the HOLD command. GOSUB Acknowledge ’Input acknowledge from instrument. PRINT "The HOLD command has put the instrument in HOLD." PRINT "Check on the instrument screen." PRINT "Press any key on the PC keyboard to continue and" PRINT "enable acquisition again." SLEEP PRINT #1, "AT" ’Sends the ARM TRIGGER command to ’enable acquisition again.
Page 3.23 ============================================================= IDENTIFICATION ID ------------------------------------------------------------Purpose: Returns the instrument model identification information.
’ ’***************** Page 3.24 Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "ID" ’Sends IDENTIFICATION query. GOSUB Acknowledge ’Input acknowledge from instrument. INPUT #1, IDENT$ ’Inputs the queried data. PRINT IDENT$ ’Displays queried data. CLOSE #1 END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument.
Page 3.25 ============================================================= INSTRUMENT STATUS IS ------------------------------------------------------------Purpose: Queries the contents of the instrument’s status register. The returned value reflects the present operational status of the instrument. This is a 16-bit word, presented as an integer value, where each bit represents the Boolean value of a related event.
Page 3.26 ’***************** Begin example program ***************** CLS ’Clears the PC screen OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "IS" ’Sends the INSTRUMENT STATUS query GOSUB Acknowledge ’Input acknowledge from instrument INPUT #1, Status$ ’Input Instrument Status StV = VAL(Status$) ’Decimal value of Instrument Status PRINT "Instrument Status : "; StV IF (StV AND 1) = 1 THEN PRINT " instrument in Maintenance mode." IF (StV AND 2) = 2 THEN PRINT " instrument charging.
’ Page 3.27 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
Page 3.28 ============================================================= PROGRAM COMMUNICATION PC ------------------------------------------------------------Purpose: Programs the baud rate for RS232 communication: Command Syntax: PC where, = 1200|2400|4800|9600|19200 (guaranteed) The default baudrate is 1200. This is set at power-on or after a Reset Instrument command (command "RI") Notes: The Fluke 43(B) supports 1 stopbit, 8 databits and software handshake (X-on X-off protocol).
Page 3.29 Response Syntax: See an example for this command under QUERY PRINT (QP).
Page 3.30 ============================================================= PROGRAM SETUP PS ------------------------------------------------------------Purpose: Restores a complete setup, previously saved with the SS (Save Setup) command and queried with the QS (Query Setup) command and saved in a string variable or to a file. Command Syntax 1: PS [] where, = 0 to 10 This is the register number where a setup is stored.
The present setup is queried from instrument and saved to file. The program asks you to change the instrument settings. Then the original setup is read from file and sent back to the instrument.
’ ’***************** Page 3.31 Begin example program ***************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 CLS GOSUB ClearPort ’Clears pending data from port. PRINT #1, "QS" ’Queries the actual setup data. GOSUB Acknowledge ’Input acknowledge from instrument. GOSUB Response ’Writes the setup data to file. PRINT "Present setup data are stored in the file SETUP0" PRINT "This setup will now be retrieved from the file and" PRINT "sent back to the instrument.
’ Page 3.32 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
’ Page 3.33 ’****************** Response subroutine ********************* ’This subroutine reads bytes from the RS232 buffer as long ’as they enter. When no bytes enter for 1 second, the program ’assumes that the instrument has terminated its response. ’All bytes that enter the buffer are appended to the string ’Resp$.
Page 3.34 ============================================================= QUERY HARMONICS QH ------------------------------------------------------------Purpose: (for the Fluke 43B only) Queries the Volt/Amp/Watt harmonics data (administration and sample data) from the instrument.
= None = 0 = 1 = 2 = 4 representing the unit: None = 0 = 11
Page 3.35 = This field contains the scale value for all amplitude samples. = This field contains the scale value for all phase samples (always 1). = Frequency of the first harmonic, which is the first non-DC spectrum component.
Page 3.36 ============================================================= QUERY MEASUREMENT QM ------------------------------------------------------------Purpose: Queries for active readings (see Syntax 1) or measurement results from the instrument (see Syntax 2).
where in Motor INRUSH CURRENT mode: = 11 : Ampere amplitude at first cursor position 21 : Ampere amplitude at second cursor position where in Meter OHMS/DIODE/CONTINUITY/CAPACITANCE and TEMPERATURE mode: = 11 : Meter reading where in SCOPE mode: = 11 : Reading of channel 1 (can be switched off) 21 : Reading of channel 2 (can be switched off) Notes: - Maximum 10 readings per command. - If one of the readings is non-valid, no readings will be returned.
Page 3.
14 15 16 18 19 20 21 22 23 24 25 26 27 28 Phase Diode Continuity Reactive Power Apparent Power Real Power Harmonic Reactive Power Harmonic Apparent Power Harmonic Real Power Harmonic rms Displacement Power Factor Total Power Factor Total Harmonic Distortion Total Harmonic Distortion with respect to Fundamental 29 K Factor (European definition) 30 K Factor (US definition) 31 Line Frequency 32 AC average presentation value of the reading: 0 Absolute value 1 Relative value 2 Logarithmic value
Page 3.38 Example: ’***************** Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "QM" ’Queries for active readings GOSUB Acknowledge ’Input acknowledge from instrument. ’*** Examines only the 7 inputs of the first reading 11. INPUT #1, reading.no ’1st IF reading.no = 11 THEN PRINT "Measurement reading 1"; ELSEIF reading.
END IF INPUT #1, presentation ’6th PRINT "Presentation of reading= "; IF presentation = 0 THEN PRINT "Absolute value" ELSEIF presentation = 1 THEN PRINT "Relative value" ELSEIF presentation = 2 THEN PRINT "Logarithmic value" ELSE PRINT "Unexpected value?" END IF INPUT #1, resolution ’7th PRINT "Resolution of reading ="; resolution GOSUB ClearReadings ’Clears rest of readings data from port ’ PRINT #1, "QM 11" ’Queries Measurement reading 1 or ’Meter absolute reading (Meter
’ Page 3.39 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
Page 3.40 ============================================================= QUERY PRINT QP ------------------------------------------------------------Purpose: Queries a screen dump of the instrument in different printer formats. This allows you to make a copy of the instrument screen on paper.
’ ’***************** Page 3.41 Begin example program ***************** CLS OPEN "COM1:1200,N,8,1,CS,DS,RB7500" FOR RANDOM AS #1 ’Programs COM1 port parameters to ’match with the instrument power-on ’defaults. PRINT #1, "PC 19200" ’Programs instrument to the maximum ’baud rate. GOSUB Acknowledge ’Input acknowledge from instrument. CLOSE #1 OPEN "COM1:19200,N,8,1,CS,DS,RB7500" FOR RANDOM AS #1 ’Programs COM1 port parameters to ’match with the new instrument ’settings.
’ Page 3.42 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
’ Page 3.43 ’****************** Response subroutine ********************* ’This subroutine reads bytes from the RS232 buffer as long ’as they enter. When no bytes enter for 1 second, the program ’assumes that the instrument has terminated its response. ’All bytes that enter the buffer are appended to the string ’Resp$.
Page 3.44 ============================================================ QUERY SETUP QS -----------------------------------------------------------Purpose: Queries the present acquisition setup data from the instrument. Command Syntax: QS [] where, = 0 to 10 This is the register number where a setup is stored. Also see the description of the Save Setup (SS) command (0 is actual setup).
Page 3.45 ============================================================= QUERY WAVEFORM QW ------------------------------------------------------------Purpose: Queries the trace data (administration and/or sample data) related to the waveform from the instrument. When a waveform is queried that is still under processing, the processing is finished first (no half traces returned).
Page 3.46 Response Syntax: [] where, = | | , If the optional parameter (V or S) is omitted: = , This includes the complete information about the trace (waveform). For detailed descriptions about the waveform structure, refer to Appendix C.
Page 3.47 Example: ’***************** Begin example program ***************** ’ ’***** If an error occurs in the waveform data, ’***** the program stops.
’ Page 3.48 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
’ Page 3.49 ’****************** Response subroutine ********************* ’This subroutine reads bytes from the RS232 buffer as long ’as they enter. When no bytes enter for 1 second, the program ’assumes that the instrument has terminated its response.
’ Page 3.50 Interpret.Admin: Resp.Count = 1 ’Byte counter for Resp$ SumCheck1% = 0 ’Sumcheck byte for Resp$ ’ ’***** Interpret the waveform data bytes ’***** in the Resp$ string (see appendix C). ’ ’***** 2 bytes block trailing : #0 IF MID$(Resp$, Resp.Count, 2) <> "#0" GOTO Wave.Error Resp.Count = Resp.Count + 2 ’ ’***** 1 byte nb = ASC(MID$(Resp$, Resp.Count, 1)) IF nb <> 128 AND nb <> 0 GOTO Wave.Error Resp.Count = Resp.
Resp.Count = Resp.Count + 2 PRINT " ’ ="; X.
’ Page 3.51 ’ DIM expscale(2) ’Exponents for Y/X.Scale DIM YXscale#(2) ’Values for Y/X.Scale ’ ’***** 3 bytes = ’***** = * 256 + ’***** = E ’***** Example: +123E-4 = 123 / 10000 = 0.0123 FOR i = 0 TO 2 SumCheck1% = (SumCheck1% + ASC(MID$(Resp$,Resp.Count+i,1))) MOD 256 NEXT i nb = ASC(MID$(Resp$, Resp.
PRINT " ’ ="; X.
’ Page 3.52 ’ DIM exponent(6) ’Exponents for Y/X.Zero & Y/X.Resol & Y/X.At.0 DIM YXvalue#(6) ’Values for Y/X.Zero & Y/X.Resol & Y/X.At.0 ’ ’***** 3 bytes = ’***** = * 256 + ’***** = E ’***** Example: +123E-4 = 123 / 10000 = 0.0123 FOR i = 0 TO 2 SumCheck1% = (SumCheck1% + ASC(MID$(Resp$,Resp.Count+i,1))) MOD 256 NEXT i nb = ASC(MID$(Resp$, Resp.
nb = nb + ASC(MID$(Resp$, Resp.
’ ’ Page 3.53 nb = nb * 256 ’Positive value nb = nb + ASC(MID$(Resp$, Resp.Count + 1, 1)) END IF exponent(3) = ASC(MID$(Resp$, Resp.Count + 2, 1)) YXvalue#(3) = nb Resp.Count = Resp.Count + 3 ’***** ’* Further calculation after ’Signed.Samples’ determination ’***** ’***** 3 bytes = ’***** = * 256 + ’***** = E ’***** Example: +123E-4 = 123 / 10000 = 0.
’
’ ’ Page 3.54 FOR i = 0 TO 2 SumCheck1% = (SumCheck1% + ASC(MID$(Resp$,Resp.Count+i,1))) MOD 256 NEXT i nb = ASC(MID$(Resp$, Resp.Count, 1)) IF nb >= 128 THEN nb = - (256 - nb) * 256 ’Negative value nb = nb + ASC(MID$(Resp$, Resp.Count + 1, 1)) ELSE nb = nb * 256 ’Positive value nb = nb + ASC(MID$(Resp$, Resp.Count + 1, 1)) END IF exponent(6) = ASC(MID$(Resp$, Resp.Count + 2, 1)) YXvalue#(6) = nb Resp.Count = Resp.Count + 3 ’***** ’* Further calculation after ’Signed.
PRINT "SumCheck so far (MOD 256) CLOSE: END ’ ="; SumCheck1% MOD 256
’ Page 3.55 Interpret.Samples: ’ ’***** Interpret the waveform data bytes ’***** in the Resp$ string (see appendix C). ’***** ’***** 1 byte separator admin/samples : , ’***** 2 bytes block trailing : #0 ’ SumCheck2% = 0 IF MID$(Resp$, Resp.Count, 3) <> ",#0" GOTO Wave2.Error Resp.Count = Resp.Count + 3 ’ ’***** 1 byte nb = ASC(MID$(Resp$, Resp.Count, 1)) IF nb <> 129 AND nb <> 0 GOTO Wave2.Error Resp.Count = Resp.
’ ’ Page 3.56 Resp.Count = Resp.Count + 1 PRINT "Signed.Samples = "; PRINT #4, "Signed.Samples = "; IF Signed.Samples = 1 THEN PRINT "TRUE "; : PRINT #4, "TRUE" ELSE PRINT "FALSE "; : PRINT #4, "FALSE" END IF PRINT "Sample.Format = "; PRINT #4, "Sample.Format = "; IF MinMax.Samples = 0 THEN PRINT "Single" PRINT #4, "Single" ELSEIF MinMax.Samples = 1 THEN PRINT "Min/Max" PRINT #4, "Min/Max" ELSEIF MinMax.Samples = 2 THEN PRINT "Min/Max/Ave" PRINT #4, "Min/Max/Ave" ELSE PRINT "Unknown: "; OCT$(Sample.
END IF NEXT j ’
’ ’ Page 3.57 Y.Zero = YXvalue#(1) X.Zero = YXvalue#(2) Y.Resol = YXvalue#(3) X.Resol = YXvalue#(4) Y.At.0 = YXvalue#(5) X.At.0 = YXvalue#(6) PRINT " ="; Y.Zero, PRINT " ="; X.Zero PRINT " ="; Y.Resol, PRINT " ="; X.Resol PRINT " ="; Y.At.0, PRINT " ="; X.At.0 ’ ’***** bytes value Sample.Byte = ASC(MID$(Resp$, Resp.Count, 1)) SumCheck2% = SumCheck2% + Sample.Byte IF (Signed.Samples = 1) AND (Sample.
’ ’ Page 3.58 ’***** bytes value Sample.Byte = ASC(MID$(Resp$, Resp.Count, 1)) SumCheck2% = SumCheck2% + Sample.Byte IF (Signed.Samples = 1) AND (Sample.Byte >= 128) THEN Sample.Byte = - (256 - Sample.Byte) END IF Invalid& = Sample.Byte FOR i = 2 TO Sample.Bytes Sample.Byte = ASC(MID$(Resp$, Resp.Count + i - 1, 1)) SumCheck2% = (SumCheck2% + Sample.Byte) MOD 256 Invalid& = Invalid& * 256 + Sample.Byte NEXT i IF (Signed.Samples = 0) OR (Invalid& < CLimit) THEN Invalid.
Resp.Count = Resp.Count + Sample.
’ ’ Page 3.59 IF i=1 OR i=2 OR i = Nbr.Of.Samples-1 OR i = Nbr.Of.Samples THEN IF (Signed.Samples = 0) OR (Sample.Value&(i) < CLimit) THEN Ampl.Value = Sample.Value&(i) * Y.Resol ’Positive value ELSE ’Negative value Ampl.Value = - ((CMaxim - Sample.Value&(i)) * Y.Resol) END IF PRINT "Sample"; i; "="; Sample.Value&(i); Ampl.Value END IF PRINT #4, "Sample"; i; "="; Sample.Value&(i); Ampl.Value NEXT i ’ ’***** 1 byte Check.Sum% = ASC(MID$(Resp$, Resp.Count, 1)) IF Check.
’ Page 3.60 Create.CSV: ’ ’***** ’***** Convert the total Response string to file Wave.CSV ’***** as input file for Excel (spreadsheet), for example. ’***** ’ OPEN "Wave.CSV" FOR OUTPUT AS #4 PRINT #4, "Title , "; IF MID$(Query$, 4, 2) = "10" THEN PRINT #4, "Voltage trace" ELSEIF MID$(Query$, 4, 2) = "11" THEN PRINT #4, "Record trace 1" END IF IF Trace.Result = 0 OR Trace.Result = 1 THEN PRINT #4, "ID ,"; Trace.Result ’Acquisition trace PRINT #4, "Type , "; "Acquisition trace" ELSEIF Trace.
PRINT #4, ’
’ ’ Page 3.61 ’***** Sample values x,y (time,amplitude) Time.Value = X.Zero ’Start at x-offset MinMax.Flag = MinMax.Samples ’Switch flag (2, 1, 0) FOR i = 1 TO Nbr.Of.Samples IF (Signed.Samples = 0) OR (Sample.Value&(i) < CLimit) THEN ’Positive value Amplit.Value = Sample.Value&(i) * Y.Resol ELSE ’Negative value Amplit.Value = - ((CMaxim - Sample.Value&(i)) * Y.Resol) END IF IF MinMax.Samples = 2 THEN ’Min/Max/Ave waveform IF MinMax.Flag = 2 THEN MinMax.Flag = MinMax.Flag - 1 PRINT #4, Time.
Page 3.62 ============================================================= READ DATE RD ------------------------------------------------------------Purpose: Reads the real time clock date settings. Command Syntax: RD Response Syntax: [] where, = string of the following format: ,, e.g. 2001,8,14 Example: The following example program reads the date setting from the instrument.
’ ’***************** Page 3.63 Begin example program ***************** CLS OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "RD" ’Sends the READ DATE query. GOSUB Acknowledge ’Input acknowledge from instrument. INPUT #1, SMYear$, SMMonth$, SMDay$ ’Inputs the date string. PRINT "Date "; SMYear$; "-"; SMMonth$; "-"; SMDay$ ’Displays the date string. END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument.
Page 3.64 ============================================================= RESET INSTRUMENT RI ------------------------------------------------------------Purpose: Resets the entire instrument, including the CPL interface. The baud rate remains unchanged. Command Syntax: RI Response Syntax: Note: Wait for at least 2 seconds after the reply has been received, to let the instrument settle itself before you send the next command.
’ Page 3.65 ’***************** Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "RI" ’Sends the RESET INSTRUMENT command. GOSUB Acknowledge ’Input acknowledge from instrument. SLEEP 2 ’Delay (2 s) necessary after reset. GOSUB ClearPort ’Clears pending data from port. PRINT #1, "ID" ’Sends IDENTIFICATION query. GOSUB Acknowledge ’Input acknowledge from instrument. INPUT #1, IDENT$ ’Inputs the queried data.
Page 3.66 ============================================================= RECALL SETUP RS ------------------------------------------------------------Purpose: Recalls an internally stored setup. This setup must have been stored in the instrument manually or with the SS (Save Setup) command. The effect of the RS command is that the instrument setup is recalled and the instrument forced to running state.
’ ’***************** Page 3.67 Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "SS 8" ’Sends SAVE SETUP command. ’Setup saved in setup memory 8. GOSUB Acknowledge ’Input acknowledge from instrument PRINT "The present setup data are stored in setup memory 8." PRINT "The remainder of this program will restore these.
’ Page 3.68 ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument. If the response is non-zero, ’the previous command was not correct or was not correctly ’received by the instrument. Then an error message is ’displayed and the program is aborted. Acknowledge: INPUT #1, ACK ’Reads acknowledge from instrument.
Page 3.69 ============================================================= READ TIME RT ------------------------------------------------------------Purpose: Reads the real time clock time settings. Command Syntax: RT Response Syntax: [
’ ’***************** Page 3.70 Begin example program ***************** OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1,"RT" ’Sends the READ TIME query. GOSUB Acknowledge ’Input acknowledge from instrument. INPUT #1,SMhour$,SMmin$,SMsec$ ’Inputs the time strings. PRINT "Time "; SMhour$;":";SMmin$;":";SMsec$ ’Displays the time string. END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument.
Page 3.71 ============================================================= SWITCH ON SO ------------------------------------------------------------Purpose: Switches the instrument on. This only works when the instrument is powered via the power adapter. Command Syntax: SO Response Syntax: See an example for this command under GET DOWN (GD).
Page 3.72 ============================================================= SAVE SETUP SS ------------------------------------------------------------Purpose: Saves the present setup in one of the battery-backup instrument registers. Command Syntax: SS where, = 1 to 10 : Screen/Setup memories When is omitted, the number 1 is assumed. Response Syntax: See an example for this command under RECALL SETUP (RS).
Page 3.73 ============================================================= STATUS QUERY ST ------------------------------------------------------------Purpose: Queries the error status of the instrument. This is a 16-bit word, presented as an integer value, where each bit represents the Boolean value of a related error event. After the reply or after a RI (Reset Instrument) command, the value is reset to zero. A complete description of the status word is given in Appendix B.
’ ’***************** Page 3.74 Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "PC 12345" ’Sends a baud rate value that is ’ out of range for the instrument. GOSUB Acknowledge.Status ’Input acknowledge from instrument ’and the status value if the ’acknowledge value is non-zero. END ’************* Acknowledge + Status subroutine *********** ’This subroutine inputs the acknowledge value from the ’instrument.
’ ’************** Page 3.75 Displays instrument status ***************** ’This subroutine gives you further information if the ’acknowledge reply from the instrument is non-zero. Status.display: PRINT #1, "ST" ’Sends the STATUS query. GOSUB Acknowledge.Status ’Inputs acknowledge from instrument. INPUT #1, STAT ’Inputs status value.
Page 3.76 ============================================================= TRIGGER ACQUISITION TA ------------------------------------------------------------Purpose: Triggers an acquisition. This command acts as a hardware trigger to start a new acquisition. In SINGLE shot acquisition mode the trigger system must have been armed with the AT (Arm Trigger) command.
’ Page 3.77 ’***************** Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "TA" ’Sends TRIGGER ACQUISITION command. GOSUB Acknowledge ’Input acknowledge from instrument. END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument.
Page 3.78 ============================================================= WRITE DATE WD ------------------------------------------------------------Purpose: Writes the real time clock date settings. Command Syntax: WD where, = string of the following format: ,, e.g. 2001,9,14 Response Syntax: Example: The following example program programs the instrument with a new date setting.
’ Page 3.79 ’***************** Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "WD 2001,9,14" ’Sets the real time clock ’to September 14, 2001 GOSUB Acknowledge ’Input acknowledge from instrument. END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument.
Page 3.80 ============================================================= WRITE TIME WT ------------------------------------------------------------Purpose: Writes the real time clock time settings. Command Syntax: WT where, = string of the following format: ,, e.g. 15,30,0 Response Syntax: Example: The following example program programs the instrument with a new time setting.
’ Page 3.81 ’***************** Begin example program ***************** CLS ’Clears the PC screen. OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1 PRINT #1, "WT 15,28,0" ’Sets the real time clock to ’03:28 p.m. (15.28). GOSUB Acknowledge ’Input acknowledge from instrument. END ’**************** Acknowledge subroutine ****************** ’Use this subroutine after each command or query sent to the ’instrument. This routine inputs the acknowledge ’response from the instrument.
Page A.1 ============================================================= APPENDIX A ACKNOWLEDGE DATA ------------------------------------------------------------The instrument returns an reply after each command or query. The value indicates correct or incorrect operation. You always must read this reply to check for the correct operation and to achieve synchronization between your program and the RS232 interface of the instrument.
Page A.2 Synchronization Error Returned when the instrument receives data while it does not expect any data. This can occur as follows: - The instrument receives a new command while a previous command or query is not yet completely executed. You can prevent this error by doing the following: 1. Read the reply after each command or query. 2. If this is zero and if a query was sent to the instrument, read all available response data.
Page B.1 ============================================================= APPENDIX B STATUS DATA ------------------------------------------------------------The Status word returned from the ST query gives you extra information when you have received a non-zero reply. The Status word is a 16-bit binary word where each bit set true represents an error event with a decimal value determined by the bit position. (See the following table.
Page C.1 ============================================================= APPENDIX C WAVEFORM DATA ------------------------------------------------------------The waveform data that is received from the QW (Query Waveform) query, consists of the following data.
= 15 = 16 = 17 = 18 = 19 = VAR, 20 = VA, 21
Page C.2 = Number of y divisions in which the waveform is displayed on the instrument screen. = Number of x divisions in which the waveform is displayed on the instrument screen. = Number of units per y division. For the Fuke 43B, 1-2-5 or 2-4-10 scale. = Number of units per x division. Depending on application mode, 1-2-5 or variable scale.
Page C.3 = This field contains the value corresponding with the lowest horizontal grid line. = This field contains the value corresponding with the most left vertical grid line. Value = 0E0 (not used).
This field specifies which value in the trace samples represents the overload value.
Page C.4 = This field specifies which value in the trace samples represents the underload value. = This field specifies which value in the trace samples represents an invalid sample. Invalid samples can be present at locations in the trace that have not been filled (yet). This can occur in random sampling, for example. = Total number of samples, Min/Max sample pairs, or Min/Average/Max sample triplets that follow.
Page D.1 ============================================================= APPENDIX D ASCII CODES ------------------------------------------------------------- Hexadecimal value | ASCII character | | Decimal value | | | 00 NUL 0 20 SP 01 SOH 1 21 ! 02 STX 2 22 " 03 ETX 3 23 # 04 EOT 4 24 $ 05 ENQ 5 25 % 06 ACK 6 26 & 07 BEL 7 27 ’ 08 BS 8 28 ( 09 HT 9 29 ) 0A LF 10 2A * 0B VT 11 2B + 0C FF 12 2C , 0D CR 13 2D 0E SO 14 2E .
Page D.