Fluke 43B Users Manual Fluke43_B_.txt

2015-09-09

: Fluke Fluke-43B-Users-Manual-809933 fluke-43b-users-manual-809933 fluke pdf

Open the PDF directly: View PDF PDF.
Page Count: 116

DownloadFluke Fluke-43B-Users-Manual Fluke43_B_.txt
Open PDF In BrowserView PDF
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.

COMMAND REFERENCE

APPENDIXES
APPENDIX
APPENDIX
APPENDIX
APPENDIX

A
B
C
D

ACKNOWLEDGE DATA
STATUS DATA
WAVEFORM DATA
ASCII CODES

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.
After power-on, the default settings of the Power Quality
Analyzer are as follows:
1200 baud, No parity, 8 data bits, 1 stop bit
You can modify the baud rate with the PC (Program
Communication) command. See chapter 3 COMMAND REFERENCE.
Other settings are fixed.
You can modify the computer RS232 port settings to match
the above settings with the following DOS command:
MODE COM1:1200,N,8,1
This command assumes that COM1 is the RS232 port used on
the computer. Replace COM1 in the above command with COM2,
COM3, or COM4 if one of these ports is used. You can place
this command in the computer startup file AUTOEXEC.BAT so
that the default settings for the computer are the same as
for the Power Quality Analyzer. If you want to use a higher
data transfer speed (baud rate), let your QBASIC program
change the settings for both the computer and the Power
Quality Analyzer. See the example under the PC (Program
Communication) command in chapter 3 COMMAND REFERENCE.

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. QuickBASIC allows you to
make executable files from programs so you can start such
programs directly from DOS.
It is assumed that you have knowledge of these programming
languages. QBASIC is supplied with Microsoft MS-DOS 5.0 and
higher and Windows 95, 98, and NT, including ’on-line’ Help.
Features of the syntax and protocol for the Power Quality
Analyzer are as follows:
- Easy input format with a ’forgiving’ syntax:
All commands consist of two characters that can be
UPPER or lower case.
Parameters that sometimes follow the command may be
separated from it by one or more separation characters.
- Strict and consistent output format:
Alpha character responses are always in UPPERCASE.
Parameters are always separated by a comma
("," = ASCII 44, see Appendix D).
Responses always end with the carriage return code
(ASCII 13). Because the carriage return code is a
non-visible character (not visible on the screen or on
paper), this character is represented as  in the
command syntax.
- Synchronization between input and output:
After receipt of every command, a Power Quality Analyzer
returns an acknowledge character (digit) followed by the
carriage return code (ASCII 13). This indicates that the
command has been successfully received and executed.
The computer program must always read this acknowledge
response before sending the next command to the
Power Quality Analyzer.

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. The SS
header is followed by a separator (space),
then followed by the parameter "8" to
indicate where to store the settings. The
meaning of this parameter is described in
Chapter 3 COMMAND REFERENCE.

Some commands require several parameters.
Example:
WT 9,50,30

This is the Write Time command.
This command requires three parameters. The
parameters are separated by a comma, which is
called the Program Data Separator. You may
use only one comma between the parameters.
Also refer to the section ’Data Separators’.

A code at the end of each command tells the Power Quality
Analyzer that the command is ended. This is the carriage
return code (ASCII 13) and is called the Program Message
Terminator. This code is needed to indicate to the Power
Quality Analyzer that the command is completed so it can
start executing the command. Also refer to the section
’Command and Response Terminators’.

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.
Example:
ID

This is the IDentification query, which asks for
the model number and the software version of the
Power Quality Analyzer.

When the Power Quality Analyzer has received a query, it
sends the  reply as it does after any command,
but now it is followed by the queried response data.
The format of the response data depends upon which query is
sent. When a response consists of different response data
portions, these are separated with commas (ASCII code 44).
Also refer to the section ’Data Separators’.
All response data,  as well as following
(queried) response data are terminated with the carriage
return code ( = ASCII 13). Also refer to the section
’Command and Response Terminators’.

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. If the command was a query, the 
response is immediately followed by the queried response data
terminated with .
If  is 1 or higher, it indicates that the
Power Quality Analyzer has not executed the command
successfully. In that case, if the command was a query, the
 response is NOT followed by any further
response data.
There can be several reasons for a non-zero 
response. For more information see Appendix A.
In case of an error you can obtain more detailed status
information by using the ST (STATUS) query.

Note:

YOU MUST ALWAYS INPUT , EVEN WHEN
THE COMMAND WAS NOT A QUERY.

Page 2.5
** Data Separators **

Data Separators are used between parameters sent to the
instrument and between values and strings received
from the instrument. Comma (",") is used as program
data separator as well as response data separator:

- Program Data Separator
Name

Character

ASCII Value
Comments
Decimal
---------------------------------------------------------comma
,
44
Single comma allowed

- Response Data Separator
Name

Character

ASCII Value
Comments
Decimal
---------------------------------------------------------comma
,
44

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. Therefore this code is represented as 
in the Command Syntax and Response Syntax lines given
for each command.
2. The QBASIC programming language, which is used for
all program examples, automatically adds a carriage
return to the end of the command output. (In the QBASIC
language, this is the PRINT #.... statement.)
After  is recognized by the instrument, the
entered command is executed. After EACH command the
instrument returns  to the
computer to signal the end of the command processing (also
see the section ’Acknowledge’.)
- Response (Message) Terminators
The response from the instrument ends with a
carriage return (ASCII 13). This is indicated as  in
the Response Syntax for each command.

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. Read the error message from
the following acknowledge subroutine, recover the error,
and repeat the command or query. (This is not shown in the
following program example.)
4. If a query was output to the instrument, input its
response.
5. The sequence of points 2, 3, and 4 may be repeated for
different commands or queries.
6. Close the communication channel.
Refer to the program example on the next page.

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. "RB2048" sets the size of the computer
’receive buffer to 2048 bytes to prevent buffer overflow
’during communication with the instrument.
PRINT #1, "ID"
’Outputs the IDENTITY command (query) to the instrument.
GOSUB Acknowledge
’This subroutine inputs the acknowledge response from
’the instrument and displays an error message if the
’acknowledge value is non-zero.
INPUT #1, Response$
’This inputs the response data from the IDENTITY query.
PRINT Response$
’Displays the queried data.
CLOSE #1
’This closes the communication channel.
END
’This ends the program.

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

*****************

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. Example:
===========================================================
AUTO SETUP
AS
----------------------------------------------------------Where
AUTO SETUP is a descriptive name for the command
(this is no syntax!),
and

AS

are the first two characters used for
the command syntax (not the complete
syntax).

- Purpose:
Explains what the command does or what it is used for.
- Command Syntax:
Shows the syntax for the command. Parameters are separated
by commas. Commands are terminated by  (carriage
return).
- Response Syntax:
Shows the format of the response from the instrument.
Responses are terminated by  (carriage return).
Each Response Syntax starts with the 
response, followed by the query response if the syntax
relates to a query.
- Example:
This is an example QBASIC program which shows how you can
use the command. The example may also include some other
commands to show the relation with these commands.
The following two comment lines (start with ’) successively
indicate the beginning and the end of an example program.
’*****************

Begin example program

****************

’******************

End example program

*****************

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.
When you have connected the Power Quality Analyzer as
indicated in the PM9080 Instruction Manual, you can start
the program from the RUN menu.

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.
This means that you may omit it for the
command, or for a response it may not appear.
Do not insert the brackets in the command!

|

This is a separator between selectable items.
This means that you must choose only one of
the items (exclusive or).

{...}

Specifies an element that may be repeated 0 or
more instances.

(...)

Grouping of multiple elements.

= 0 to 255
 =

0 to 9

 =

+ | -

=

{}

 = 
 = 
 = 
 =

 =


Two bytes representing a signed
integer value. The first byte is the
most significant and contains the
sign bit (bit 7).
four ’s

= 
Two bytes representing an unsigned
integer value. The first byte is the
most significant.
 =
four ’s

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.30
QUERY HARMONICS
QH
3.34
QUERY MEASUREMENT
QM
3.36
QUERY PRINT
QP
3.40
QUERY SETUP
QS
3.44
QUERY WAVEFORM
QW
3.45
READ DATE
RD
3.62
RESET INSTRUMENT
RI
3.64
RECALL SETUP
RS
3.66
READ TIME
RT
3.69
SWITCH ON
SO
3.71
SAVE SETUP
SS
3.72
STATUS QUERY
ST
3.73
TRIGGER ACQUISITION
TA
3.76
WRITE DATE
WD
3.78
WRITE TIME
WT
3.80

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.

Command Syntax:
AS

Response Syntax:


Example:
The following example program sends an AUTO SETUP command to
the instrument. Connect a repetitive signal on
INPUT 1 to see the effect of AUTO SETUP.

’
’*****************

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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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.

Command Syntax:
AT

Response Syntax:


Example:
The following example program arms the trigger system of
the instrument with the AT command.
This means that after this command the instrument starts an
acquisition when a trigger occurs from the signal (when
exceeding the trigger level) or from a TA (Trigger
Acquisition) command.
After the AT command it is assumed that the signal amplitude
is sufficient to trigger the acquisition. If it is not, you
can use the TA (TRIGGER ACQUISITION) command to force the
acquisition to be triggered. But this is not useful if you
want the acquisition to be started on a signal edge for
synchronization purposes.
Also see the example program for the IS command, which also
uses the AT command for a single shot application.

’*****************

Begin example program

*****************

OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1
PRINT #1, "AT"
’Sends the ARM TRIGGER command.
GOSUB Acknowledge
’Input acknowledge from instrument.
CLOSE #1
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

Page 3.9
=============================================================
CLEAR MEMORY
CM
------------------------------------------------------------Purpose:
Clears all saved setups, waveforms, and screens from
memory.

Command Syntax:
CM

Response Syntax:

Example:

’
’*****************

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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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.

Command Syntax:
DS

Response Syntax:

Note:

Example:

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.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.
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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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.

Command Syntax:
GD

Response Syntax:


Example:

’
’*****************

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.
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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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.

Command Syntax:
GL

Response Syntax:


Example:
The following example uses the GR (GO TO REMOTE) command
(refer to the description for this command) to set the
instrument in the REMOTE state so that the keypad
is disabled. After that, the GL (GO TO LOCAL) command
is sent so that the keypad is enabled again.

’
’*****************

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.
GOSUB Acknowledge
’Input acknowledge from instrument.
PRINT "The instrument keys are now enabled again by the "
PRINT "GL (GO TO LOCAL) command."
PRINT "Check this."
CLOSE #1
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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.

Command Syntax:
HO

Response Syntax:


Example:

’
’*****************

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.
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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

Page 3.23
=============================================================
IDENTIFICATION
ID
------------------------------------------------------------Purpose:
Returns the instrument model identification information.

Command Syntax:
ID

Response Syntax:
[]
where,
 is an ASCII string containing the following
data elements:
;;
;

Example:
The following example program queries the identity data of
the instrument and displays this data on the PC screen.

’
’*****************

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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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.
Command Syntax:
IS
Response Syntax:
[]
where,
 =

integer value 0 to 65535


Bit Value
Status Description
---------------------------------------------------------0
1
Maintenance mode
1
2
Charging
2
4
Recording
3
8
AutoRanging
4
16
Remote
5
32
Battery Connected
6
64
Power (Net) Adapter connected
7
128
Calibration necessary
8
256
Instrument Held (HOLD status)
9
512
Pre Calibration busy
10
1024
Pre Calibration valid
11
2048
12
4096
Triggered
13
8192
Instrument On
14 16384
Instrument Reset occurred
15 32768
Next  value available
Example:

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."
IF (StV AND 4) = 4 THEN PRINT " instrument recording."
IF (StV AND 8) = 8 THEN PRINT " AutoRanging active"
IF (StV AND 16) = 16 THEN PRINT " instrument remote."
IF (StV AND 32) = 32 THEN PRINT " Battery connected."
IF (StV AND 64) = 64 THEN PRINT " Power Adapter connected."
IF (StV AND 128) = 128 THEN PRINT " Calibration necessary."
IF (StV AND 256) = 256 THEN PRINT " instrument in HOLD."
IF (StV AND 512) = 512 THEN PRINT " Pre-calibration busy."
IF (StV AND 1024) = 1024 THEN PRINT " Pre-calibration valid."
IF (StV AND 4096) = 4096 THEN PRINT " instrument triggered."
IF (StV AND 8192) = 8192 THEN
PRINT " instrument On."
ELSE
PRINT " instrument Off."
END IF
IF (StV AND 16384) = 16384 THEN PRINT " Reset Instrument occurred."
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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).
Hardware handshaking is not supported.

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. Also see the
description of the Save Setup (SS)
command (0 is actual setup).
Response Syntax 1:

Command Syntax 2:

 =

The data returned with the QS command.
( response).

Response Syntax 2:

Note:

Wait for at least two seconds after the
 reply has been received, to let
the instrument settle itself before you send the
next command.

Remarks:
The instrument sends the  reply
after it has executed the setup from the PS command.
You must send the  string as a whole, exactly as
returned from the QS (Query Setup) command.
If you do not follow this rule, the instrument
may crash. A Reset may then be necessary to recover
the instrument. (Refer to the instrument Users Manual.)
Example:
The following example program demonstrates the use of the
QS (QUERY SETUP) and the PS (PROGRAM SETUP) commands.

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."
PRINT "To see if this works, change the present settings and"
PRINT "verify if the instrument returns to the previous"
PRINT "settings."
PRINT
PRINT "Press any key on the PC keyboard to continue."
SLEEP
CLS
PRINT #1, "PS"
’Program header for programming
’the setup data to the instrument.
GOSUB Acknowledge
’Input acknowledge from instrument.
OPEN "SETUP0" FOR INPUT AS #2
’Opens file SETUP0 for data retrieval.
DO WHILE NOT EOF(2)
SUCHR$ = INPUT$(1, #2)
’Reads setup data from file
PRINT #1, SUCHR$;
’Programs instrument with the"
’setup data stored in SETUP0$.
LOOP
PRINT #1, CHR$(13);
’Program message terminator
CLOSE #2
’Close file SETUP0.
GOSUB Acknowledge
’Input acknowledge from instrument.
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******* Clears pending data from the RS232 port *********
ClearPort:
WHILE LOC(1) > 0
Dummy$ = INPUT$(1, #1)
WEND
RETURN
’

’

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$.
Response:
start! = TIMER
’Wait for bytes (maximum 1 s) to enter RS232 buffer
WHILE ((TIMER < (start! + 1)) AND (LOC(1) = 0))
WEND
IF LOC(1) > 0 THEN
’If RS232 buffer contains bytes
OPEN "Setup0" FOR OUTPUT AS #2
’File for setup data
DO
’ LOC(1) gives the number of bytes waiting:
ScopeInput$ = INPUT$(LOC(1), #1)
’Input bytes
PRINT #2, ScopeInput$;
start! = TIMER
WHILE ((TIMER < (start! + 1)) AND (LOC(1) = 0))
WEND
LOOP WHILE LOC(1) > 0
’Repeat as long as bytes enter
CLOSE #2
END IF
RETURN
’******************

End example program

******************

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.
Command Syntax:
QH []
where,
 = 
 = ASCII "1" or "2" for channel 1 or 2
ASCII "3" for channel 1 and 2
 = ASCII "0"/"1"/"2" for Volt/Ampere/Watt harmonics
Possible values are:
QH 10 : Volt harmonics using channel 1
QH 21 : Ampere harmonics using channel 2
QH 32 : Watt harmonics using channel 1 and 2
If QH command is sent without arguments, the active 
is returned.
If QH command is sent with , the
Response Syntax is:
,
where,
 =

#0





 = 
Value is 128.
 = 
This value gives the number of bytes that
are transmitted after the 
and before the .
 =


0 = Invalid, 1 = Valid

= 
 representing the unit:

 =

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.
 =
 =
=
 =






 =
 =
=
=






 =


One binary character which represents the sum
of all the ’s sent after
the  and before the .

 =

#0


= 
Value is 129.
= 
This (2-bytes) value gives the number of bytes
that are transmitted after the 
and before the .
= 
Total number of harmonics samples that follow.
 =

{}

= 
 = 
 =


One binary character which represents the sum
of all the ’s sent after
the  and before the .

Example: The method for reading and analyzing harmonics data (QH)
is similar for reading and analyzing waveforms (QW).

Page 3.36
=============================================================
QUERY MEASUREMENT
QM
------------------------------------------------------------Purpose:
Queries for active readings (see Syntax 1) or measurement
results from the instrument (see Syntax 2).
Command Syntax 1:
QM
Command Syntax 2:
QM {,}
where in VOLTS/AMPS/HERTZ mode:
 = 11 : Voltage rms (ac + dc)
21 : Ampere rms (ac + dc)
31 : Line Frequency on trigger channel
41 : Crest on channel 1 (Fluke 43B only)
51 : Crest on channel 2 (Fluke 43B only)
where in POWER mode: (relative to %r or %f)
 = 11 : Real power
21 : Apparent power
31 : Reactive power
41 : Total Power Factor (TPF) (Fluke 43B only)
51 : Displacement Power Factor (DPF or cos phi)
61 : Line Frequency
where in HARMONICS mode: (Volt/Ampere/Watt mode)
 = 11 : Total Harmonic Distortion (THD, not Watts mode)
21 : Total rms reading
31 : K-factor (not in Volts mode)
41 : Frequency of selected harmonic component
51 : Absolute rms of selected harmonic component
61 : Relative rms (% of Total rms) of selected
harmonic component
71 : Phase of selected harmonic component
where in SAGS & SWELLS mode:
 = 11 : Voltage rms (ac + dc)
21 : Ampere rms (ac + dc)
where in TRANSIENTS mode: (at cursor position of the
selected transient)
 = 11 : Maximum Voltage peak
21 : Minimum Voltage peak
31 : Maximum Ampere peak
41 : Minimum Ampere peak
where in TRANSIENTS Learn mode:
 = 11 : Voltage rms (ac + dc)
21 : Line Frequency on Voltage channel

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.
- Only active (valid) readings will be returned.

Page 3.37
Response Syntax 1:
[{,}]
where,
 = ,,,,,,

see Command Syntax 2
 validity of the reading:
1 reading valid
0 reading non-valid
 source of the reading:
1 Voltage channel: Input A (Scope mode)
2 Ampere channel: Input B (Scope mode)
3 Input external: COM & V/Ohm/Diode (Meter mode)
12 Input_AB (Phase A over B): A>B (Scope mode)
21 Input_BA (Phase B over A): B>A (Scope mode)

unit of the reading:
0 None (off)
1 Volt
2 Ampere
3 Ohm
4 Watt
5 Farad
6 Kelvin
7 seconds
8 hours
9 days
10 Hertz
11 Degrees
12 Celsius
13 Fahrenheit
14 percentage (%)
15 dBm 50 Ohm
16 dBm 600 Ohm
17 dB Volt
18 dB Ampere
19 dB Watt
20 Volt * Ampere Reactive (VAR)
21 Volt * Ampere (VA)

reading characteristic of the measurement:
0 None
1 Mean
2 Rms
3 True rms
4 Peak peak
5 Peak maximum
6 Peak minimum
7 Crest factor
8 Period
9 Duty cycle negative
10 Duty cycle positive
11 Frequency
12 Pulse width negative
13 Pulse width positive

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
3 Linear value
4 Fahrenheit
5 Celsius
resolution of the reading as  to
determine the least significant digit

Response Syntax 2:
[{,}]
where,
 = []E
Note: Only displayed results are available for output.

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.no = 21 THEN
PRINT "Measurement reading 2";
ELSE
PRINT "Unknown measurement reading";
END IF
INPUT #1, validity
’2nd 
IF validity = 1 THEN
PRINT " is valid"
ELSE
PRINT " is ’not’ valid"
END IF
INPUT #1, source
’3rd 
PRINT "Source of reading
= ";
IF source = 1 THEN
PRINT "Voltage channel Input A"
ELSEIF source = 2 THEN
PRINT "Ampere channel Input B"
ELSEIF source = 3 THEN
PRINT "Input External"
ELSE
PRINT "Unknown source?"
END IF
INPUT #1, unit
’4th 
PRINT "Unit of reading
= ";
IF unit = 1 THEN
PRINT "Volt"
ELSEIF unit = 2 THEN
PRINT "Ampere"
ELSEIF unit = 3 THEN
PRINT "Ohm"
ELSE
PRINT "Unexpected unit?"
END IF
INPUT #1, types
’5th 
PRINT "Type of reading
= ";
IF types = 1 THEN
PRINT "Mean value"
ELSEIF types = 2 THEN
PRINT "Rms value"
ELSEIF types = 3 THEN
PRINT "True rms value"
ELSE
PRINT "Unexpected characteristic?"

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 mode).
GOSUB Acknowledge
’Input acknowledge from instrument.
INPUT #1, result
PRINT "Measurement value
="; result; "V"
CLOSE #1
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******* Clears pending data from the RS232 port *********
ClearReadings:
LINE INPUT #1, dummy$
WHILE LOC(1) > 0
LINE INPUT #1, dummy$
WEND
RETURN
’******************

End example program

******************

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.
Command Syntax:
QP ,
where,
 = 0

Always zero

 = 0
1
2
3

Epson FX, LQ compatible
Laser Jet
Desk Jet
PostScript

Response Syntax:
[]

This data can directly be sent to the printer to get a
screen copy on paper.
Example:
The following program reads the instrument screen (print)
data and copies this data to the file Qpfile. Hereafter, you
can copy this file to the printer port LPT1, for example.
The Read Buffer length for the PC is set to 7500 bytes to
prevent buffer overflow during input from the instrument.
The data transfer speed (baud rate) is set to 19200 and after
the output it is set back to 1200 (default baud rate).

’
’*****************

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.
PRINT #1, "QP 0,1"
’Sends QUERY PRINT data command.
’(actual screen for LaserJet print)
GOSUB Acknowledge
’Input acknowledge from instrument.
PRINT
PRINT "Busy reading print data !"
PRINT
GOSUB Response
PRINT #1, "PC 1200"
’Programs instrument back to the
’default baud rate.
GOSUB Acknowledge
’Input acknowledge from instrument.
PRINT "Print data copied to file ’QPFILE’."
PRINT "You can copy the file contents to the Laser Printer."
PRINT "DOS-example: COPY Qpfile LPT1"
CLOSE
’Close all files.
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’

’

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$.
Response:
start! = TIMER
’Wait for bytes (maximum 2 s) to enter RS232 buffer
WHILE ((TIMER < (start! + 2)) AND (LOC(1) = 0))
WEND
IF LOC(1) > 0 THEN
’If RS232 buffer contains bytes
Resp$ = ""
OPEN "Qpfile" FOR OUTPUT AS #2
’File for print data
DO
’ LOC(1) gives the number of bytes waiting:
ScopeInput$ = INPUT$(LOC(1), #1)
’Input bytes
PRINT #2, ScopeInput$;
start! = TIMER
WHILE ((TIMER < (start! + 2)) AND (LOC(1) = 0))
WEND
LOOP WHILE LOC(1) > 0
’Repeat as long as bytes enter
CLOSE #2
END IF
RETURN
’******************

End example program

******************

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).
Response Syntax:
[#0{}]
where,
 =


[]
 = 
Possible values:
20 hex
All nodes except the last node
A0 hex
End node
 = 
Unique number for each specific node.
 = 
Specifies the number of 
fields that follow in the 
field.
 =
{}
The contents of  depends on the
 and the selected setup.
 =

Contains the sum of all the binary bytes
in the  field.
Note: Also see the Program Setup (PS) command.
See an example for this command under PROGRAM SETUP (PS).

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).
Command Syntax:
QW

returns list of available trace numbers

QW [,V|S]
 =  assigned to the following
Trace Sources:
 Trace Source:
--------------------------------------------10
MinMax voltage trace INPUT 1
Modes: VOLTS/AMPS/HERTZ
POWER
TRANSIENTS
SCOPE
11
24-bits Min/Max/Avg record trace 1
Modes: VOLTS/AMPS/HERTZ (see Note)
POWER
(see Note)
HARMONICS
(see Note)
SAGS & SWELLS
SCOPE
(see Note)
Meter
(see Note)
20
MinMax current trace INPUT 2
Modes: VOLTS/AMPS/HERTZ
POWER
TRANSIENTS
INRUSH CURRENT
SCOPE
(see Note)
21
24-bits Min/Max/Avg record trace 2
Modes: VOLTS/AMPS/HERTZ (see Note)
POWER
(see Note)
HARMONICS
(see Note)
SAGS & SWELLS
SCOPE
(see Note)
Note: Availability depends on other instrument
setup variables.
V | v
S | s

Trace values (samples) only
Setup (administration) data only. When V or S is
omitted, trace vales and setup data are 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.
If option V or v (value only) is given:
 = 
For detailed descriptions about the waveform structure,
refer to Appendix C.
If option S or s (Setup data only) is given:
 = 
where,
 =

string of hexadecimal characters,
representing the setup related to the given
.

Page 3.47
Example:
’***************** Begin example program *****************
’
’***** If an error occurs in the waveform data,
’***** the program stops.
’
C65536 = 65536
’2-bytes Maximum constant
C32768 = 32768
’2-bytes Sign-bit constant
C256
=
256
’1-byte Maximum constant
C128
=
128
’1-byte Sign-bit constant
OPEN "COM1:1200,N,8,1,CS,DS,RB2048" FOR RANDOM AS #1
CLS
GOSUB ClearPort
’Clears pending data from port
’
Query$ = "QW 10"
’Queries voltage trace INPUT 1
’
’*****
’* A normal trace is a series of waveform samples consisting
’* of single waveform points.
’* A min/max trace is a series of waveform samples consisting
’* of minimum and maximum waveform points.
’* A min/max/average trace is a series of waveform samples
’* consisting of minimum, maximum, and average waveform points.
’*****
PRINT #1, Query$
’Response = ,
GOSUB Acknowledge
’Inputs acknowledge from instrument
Resp$ = ""
’Clears the total Response string
GOSUB Response
’Writes waveform data to Resp$ & files
GOSUB Interpret.Admin
’Interprets waveform administration data
’See also Appendix C
GOSUB Interpret.Samples ’Interprets waveform sample data
GOSUB Create.CSV
’Creates Wave.CSV file from waveform data
’as input for Excel, for example.
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******* Clears pending data from the RS232 port *********
ClearPort:
WHILE LOC(1) > 0
Dummy$ = INPUT$(1, #1)
WEND
RETURN
’

’

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. All
’bytes that enter the buffer are appended to the string Resp$
’and are written to the following files:
’File Waveform : the waveform data bytes
’File Waveresp : the waveform ASCII values
’
Response:
start! = TIMER
’Wait for bytes (maximum 1 s) to enter RS232 buffer
WHILE ((TIMER < (start! + 1)) AND (LOC(1) = 0))
WEND
IF LOC(1) > 0 THEN
’If RS232 buffer contains bytes
OPEN "WaveForm" FOR OUTPUT AS #2
’File to contain the waveform data bytes
docount = 1
total.count& = 0
DO
’ LOC(1) gives the number of bytes waiting:
total.count& = total.count& + LOC(1)
ScopeInput$ = INPUT$(LOC(1), #1)
’Input bytes
PRINT #2, ScopeInput$;
PRINT total.count&;
Resp$ = Resp$ + ScopeInput$
start! = TIMER
WHILE ((TIMER < (start! + 1)) AND (LOC(1) = 0))
WEND
docount = docount + 1
LOOP WHILE LOC(1) > 0
’Repeat as long as bytes enter
CLOSE #2
PRINT
END IF
’
’***** Write the total Response string to file WaveResp
’
OPEN "WaveResp" FOR OUTPUT AS #3
PRINT "Response data length = "; LEN(Resp$)
PRINT #3, "Response data length = "; LEN(Resp$)
FOR i = 1 TO LEN(Resp$)
PRINT #3, ASC(MID$(Resp$, i, 1));
NEXT i
CLOSE #3: RETURN
’

’
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.Count + 1
’
’***** 2 bytes 
Block1.Length = ASC(MID$(Resp$, Resp.Count, 1)) * 256
Block1.Length = Block1.Length + ASC(MID$(Resp$, Resp.Count + 1, 1))
Resp.Count = Resp.Count + 2
’
’***** 1 byte  : 0, 1, or 2
Trace.Result = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck1% = SumCheck1% + Trace.Result
IF Trace.Result < 0 OR Trace.Result > 2 GOTO Wave.Error
Resp.Count = Resp.Count + 1
’
’***** 1 byte 
Y.Unit = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck1% = SumCheck1% + Y.Unit
Resp.Count = Resp.Count + 1
PRINT "
="; Y.Unit,
’
’***** 1 byte 
X.Unit = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck1% = SumCheck1% + X.Unit
Resp.Count = Resp.Count + 1
PRINT "

="; X.Unit
’
’***** 2 bytes 
Sample.Byte = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck1% = SumCheck1% + Sample.Byte
Y.Divisions = Sample.Byte * 256
Sample.Byte = ASC(MID$(Resp$, Resp.Count + 1, 1))
SumCheck1% = SumCheck1% + Sample.Byte
Y.Divisions = Y.Divisions + Sample.Byte
Resp.Count = Resp.Count + 2
PRINT "
="; Y.Divisions,
’
’***** 2 bytes 
Sample.Byte = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck1% = SumCheck1% + Sample.Byte
X.Divisions = Sample.Byte * 256
Sample.Byte = ASC(MID$(Resp$, Resp.Count + 1, 1))
SumCheck1% = SumCheck1% + Sample.Byte
X.Divisions = X.Divisions + Sample.Byte

Resp.Count = Resp.Count + 2
PRINT "

’

="; X.Divisions

’
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.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
expscale(1) = ASC(MID$(Resp$, Resp.Count + 2, 1))
YXscale#(1) = nb
Resp.Count = Resp.Count + 3
’*****
’* Further calculation after ’Signed.Samples’ determination
’*****
’***** 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.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
expscale(2) = ASC(MID$(Resp$, Resp.Count + 2, 1))
YXscale#(2) = nb
Resp.Count = Resp.Count + 3
’*****
’* Further calculation after ’Signed.Samples’ determination
’*****
’***** 1 byte 
Y.Step = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck1% = SumCheck1% + Y.Step
Resp.Count = Resp.Count + 1
PRINT "
="; Y.Step,
’
’***** 1 byte 
X.Step = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck1% = SumCheck1% + X.Step
Resp.Count = Resp.Count + 1

PRINT "
’



="; X.Step

’
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.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(1) = ASC(MID$(Resp$, Resp.Count + 2, 1))
YXvalue#(1) = nb
Resp.Count = Resp.Count + 3
’*****
’* Further calculation after ’Signed.Samples’ determination
’*****
’***** 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.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(2) = ASC(MID$(Resp$, Resp.Count + 2, 1))
YXvalue#(2) = nb
Resp.Count = Resp.Count + 3
’*****
’* Further calculation after ’Signed.Samples’ determination
’*****
’***** 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.Count, 1))
IF nb >= 128 THEN
nb = - (256 - nb) * 256
’Negative value

nb = nb + ASC(MID$(Resp$, Resp.Count + 1, 1))
ELSE
’

’
’

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.0123
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(4) = ASC(MID$(Resp$, Resp.Count + 2, 1))
YXvalue#(4) = nb
Resp.Count = Resp.Count + 3
’*****
’* Further calculation after ’Signed.Samples’ determination
’*****
’***** 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.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(5) = ASC(MID$(Resp$, Resp.Count + 2, 1))
YXvalue#(5) = nb
Resp.Count = Resp.Count + 3
’*****
’* Further calculation after ’Signed.Samples’ determination
’*****
’***** 3 bytes  = 
’*****  =  * 256 + 
’*****  =  E 
’*****
Example: +123E-4 = 123 / 10000 = 0.0123

’

’
’

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.Samples’ determination
’*****
’***** 8 bytes 
FOR i = 0 TO 7
SumCheck1% = (SumCheck1% + ASC(MID$(Resp$,Resp.Count+i,1))) MOD 256
NEXT i
Year$ = MID$(Resp$, Resp.Count, 1)
Year$ = Year$ + MID$(Resp$, Resp.Count + 1, 1)
Year$ = Year$ + MID$(Resp$, Resp.Count + 2, 1)
Year$ = Year$ + MID$(Resp$, Resp.Count + 3, 1)
Month$ = MID$(Resp$, Resp.Count + 4, 1)
Month$ = Month$ + MID$(Resp$, Resp.Count + 5, 1)
Day$ = MID$(Resp$, Resp.Count + 6, 1)
Day$ = Day$ + MID$(Resp$, Resp.Count + 7, 1)
Resp.Count = Resp.Count + 8
PRINT "
= "; Year$ + "-" + Month$ + "-" + Day$;
’
’***** 6 bytes 
FOR i = 0 TO 5
SumCheck1% = (SumCheck1% + ASC(MID$(Resp$,Resp.Count+i,1))) MOD 256
NEXT i
Hours$ = MID$(Resp$, Resp.Count, 1)
Hours$ = Hours$ + MID$(Resp$, Resp.Count + 1, 1)
Minutes$ = MID$(Resp$, Resp.Count + 2, 1)
Minutes$ = Minutes$ + MID$(Resp$, Resp.Count + 3, 1)
Seconds$ = MID$(Resp$, Resp.Count + 4, 1)
Seconds$ = Seconds$ + MID$(Resp$, Resp.Count + 5, 1)
Resp.Count = Resp.Count + 6
PRINT "

= "; Hours$+":"+Minutes$+":"+Seconds$
’
’***** 1 byte 
Check.Sum% = ASC(MID$(Resp$, Resp.Count, 1))
IF Check.Sum% <> (SumCheck1% MOD 256) GOTO Wave.Error
Resp.Count = Resp.Count + 1
PRINT " ="; Check.Sum%; " & ";
PRINT "SumCheck1 MOD 256 ="; SumCheck1% MOD 256
RETURN
Wave.Error:
PRINT "Waveform admin error at byte :"; Resp.Count
PRINT "Waveform decimal byte value
="; ASC(MID$(Resp$,Resp.Count,1))

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.Count + 1
’
’***** 2 bytes 
Block2.Length& = ASC(MID$(Resp$, Resp.Count, 1))
Block2.Length& = Block2.Length& * 256
Block2.Length& = Block2.Length& + ASC(MID$(Resp$,Resp.Count+1,1))
Resp.Count = Resp.Count + 2
PRINT "Number of sample chars ="; Block2.Length&
OPEN "Samples" FOR OUTPUT AS #4
PRINT #4, "Number of sample chars ="; Block2.Length&
’
’***** 1 byte 
Sample.Format = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck2% = SumCheck2% + Sample.Format
IF (Sample.Format AND 128) = 128 THEN
Signed.Samples = 1
ELSE
Signed.Samples = 0
END IF
IF (Sample.Format AND 112) = 64 THEN ’bits 6, 5, 4
MinMax.Samples = 1
’Min/Max=100
ELSEIF (Sample.Format AND 112) = 96 THEN
MinMax.Samples = 2
’Min/Max/Ave=110
ELSEIF (Sample.Format AND 112) = 0 THEN
MinMax.Samples = 0
’Normal=000
ELSEIF (Sample.Format AND 112) = 112 THEN
IF MID$(Query$, 5, 1) = "1" THEN
’TrendPlot
MinMax.Samples = 2
’Min=Max=Ave=111
ELSE
’Average Min/Max
MinMax.Samples = 1
’Min=Max=111
END IF
ELSE
MinMax.Samples = 7
’Unknown format!
END IF
Sample.Bytes = Sample.Format AND 7
IF Sample.Bytes = 1 THEN
’Single-byte samples
CLimit = C128 : CMaxim = C256
ELSE
’Double-byte samples
CLimit = C32768 : CMaxim = C65536
END IF
’

’
’

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.Format); " octal"
PRINT #4, "Unknown: "; OCT$(Sample.Format); " octal"
END IF
PRINT "Number of Sample.Bytes ="; Sample.Bytes
PRINT #4, "Number of Sample.Bytes ="; Sample.Bytes
’*****
’* Further calculation now that ’Signed.Samples’ is determined
’*****
FOR j = 1 TO 2
IF expscale(j) > 127 THEN
’Negative exponent
expscale(j) = 256 - expscale(j)
FOR i = 1 TO expscale(j)
YXscale#(j) = YXscale#(j) / 10
NEXT i
ELSE
’Positive exponent
FOR i = 1 TO expscale(j)
YXscale#(j) = YXscale#(j) * 10
NEXT i
END IF
NEXT j
Y.Scale = YXscale#(1)
X.Scale = YXscale#(2)
PRINT "
="; Y.Scale,
PRINT "

="; X.Scale
’
FOR j = 1 TO 6
IF exponent(j) > 127 THEN
’Negative exponent
exponent(j) = 256 - exponent(j)
FOR i = 1 TO exponent(j)
YXvalue#(j) = YXvalue#(j) / 10
NEXT i
ELSE
’Positive exponent
FOR i = 1 TO exponent(j)
YXvalue#(j) = YXvalue#(j) * 10
NEXT i

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.Byte >= 128) THEN
Sample.Byte = - (256 - Sample.Byte)
END IF
Overload& = Sample.Byte
FOR i = 2 TO Sample.Bytes
Sample.Byte = ASC(MID$(Resp$, Resp.Count + i - 1, 1))
SumCheck2% = (SumCheck2% + Sample.Byte) MOD 256
Overload& = Overload& * 256 + Sample.Byte
NEXT i
IF (Signed.Samples = 0) OR (Overload& < CLimit) THEN
Overload.Value = Overload& * Y.Resol
’Positive value
ELSE
’Negative value
Overload.Value = - ((CMaxim - Overload&) * Y.Resol)
END IF
Resp.Count = Resp.Count + Sample.Bytes
PRINT "Overload sample value ="; Overload&; Overload.Value
PRINT #4, "Overload sample value ="; Overload&; Overload.Value
’
’*****  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
Underload& = Sample.Byte
FOR i = 2 TO Sample.Bytes
Sample.Byte = ASC(MID$(Resp$, Resp.Count + i - 1, 1))
SumCheck2% = (SumCheck2% + Sample.Byte) MOD 256
Underload& = Underload& * 256 + Sample.Byte
NEXT i
IF (Signed.Samples = 0) OR (Underload& < CLimit) THEN
Underload.Value = Underload& * Y.Resol
’Positive value
ELSE
’Negative value
Underload.Value = - ((CMaxim - Underload&) * Y.Resol)
END IF
Resp.Count = Resp.Count + Sample.Bytes
PRINT "Underload sample value ="; Underload&; Underload.Value
PRINT #4, "Underload sample value ="; Underload&; Underload.Value

’

’
’

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.Value = Invalid& * Y.Resol ’Positive value
ELSE
’Negative value
Invalid.Value = - ((CMaxim - Invalid&) * Y.Resol)
END IF
Resp.Count = Resp.Count + Sample.Bytes
PRINT "Invalid sample value
="; Invalid&; Invalid.Value
PRINT #4, "Invalid sample value
="; Invalid&; Invalid.Value
’
’***** 2 bytes 
Sample.Byte = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck2% = (SumCheck2% + Sample.Byte) MOD 256
Nbr.Of.Samples = Sample.Byte
Sample.Byte = ASC(MID$(Resp$, Resp.Count + 1, 1))
SumCheck2% = (SumCheck2% + Sample.Byte) MOD 256
Nbr.Of.Samples = Nbr.Of.Samples * 256 + Sample.Byte
IF MinMax.Samples = 1 THEN
’Min/Max pair of samples
Nbr.Of.Samples = Nbr.Of.Samples * 2
END IF
IF MinMax.Samples = 2 THEN
’Min/Max/Ave samples
Nbr.Of.Samples = Nbr.Of.Samples * 3
END IF
Resp.Count = Resp.Count + 2
PRINT "Number of samples
="; Nbr.Of.Samples
PRINT #4, "Number of samples
="; Nbr.Of.Samples
’
’*****  bytes ’s
’
DIM Sample.Value(Nbr.Of.Samples) AS LONG
FOR i = 1 TO Nbr.Of.Samples
’Sample loop
Sample.Byte = ASC(MID$(Resp$, Resp.Count, 1))
SumCheck2% = (SumCheck2% + Sample.Byte) MOD 256
IF (Signed.Samples = 1) AND (Sample.Byte >= 128) THEN
Sample.Byte = - (256 - Sample.Byte)
END IF
Sample.Value&(i) = Sample.Byte
IF Sample.Bytes > 1 THEN
’More sample bytes
FOR j = 2 TO Sample.Bytes
Sample.Byte = ASC(MID$(Resp$, Resp.Count + j - 1, 1))
SumCheck2% = (SumCheck2% + Sample.Byte) MOD 256
Sample.Value&(i) = Sample.Value&(i) * 256 + Sample.Byte
NEXT j
END IF

Resp.Count = Resp.Count + Sample.Bytes
’

’
’

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.Sum% <> (SumCheck2% MOD 256) GOTO Wave2.Error
Resp.Count = Resp.Count + 1
PRINT " ="; Check.Sum%; " & ";
PRINT "SumCheck2 MOD 256 ="; SumCheck2% MOD 256
PRINT #4, " ="; Check.Sum%; " & ";
PRINT #4, "SumCheck2 MOD 256 ="; SumCheck2% MOD 256
’
’***** 1 byte CR
C.R = ASC(MID$(Resp$, Resp.Count, 1))
IF C.R <> 13 GOTO Wave2.Error
Resp.Count = Resp.Count + 1
CLOSE #4: RETURN
Wave2.Error:
PRINT "Waveform sample error at byte :"; Resp.Count
PRINT "Waveform decimal byte value
="; ASC(MID$(Resp$,Resp.Count,1))
PRINT "SumCheck so far (MOD 256)
="; SumCheck2% MOD 256
CLOSE: END
’

’
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.Result = 2 THEN
PRINT #4, "ID
,"; 2
’Record trace
PRINT #4, "Type
, "; "Record trace"
END IF
PRINT #4, "Date
, "; Month$+"/"+Day$+"/"+MID$(Year$,3,2)
PRINT #4, "Time
, "; Hours$+":"Minutes$+":"+Seconds$
’
’***** X.Scale = time per division (over 10 divisions)
PRINT #4, "X Scale
,"; X.Scale
PRINT #4, "X At 0%
,"; X.Zero
PRINT #4, "X Resolution ,"; X.Resol
PRINT #4, "X Size
,"; Nbr.Of.Samples
PRINT #4, "X Unit
, ";
IF X.Unit = 7 THEN PRINT #4, "s"
IF X.Unit = 10 THEN PRINT #4, "Hz"
PRINT #4, "X Label
,";
IF X.Unit = 7 THEN PRINT #4, X.Scale; "s/Div"
IF X.Unit = 10 THEN PRINT #4, X.Scale; "Hz/Div"
’
PRINT #4, "Y Scale
,"; Y.Scale
PRINT #4, "Y At 50%
,"; Y.Zero
PRINT #4, "Y Resolution ,"; Y.Resol
PRINT #4, "Y Size
,";
IF Sample.Bytes = 1 THEN
’1-byte samples
PRINT #4, 256
END IF
’Range = 256
IF Sample.Bytes = 2 THEN
’2-byte samples
PRINT #4, 65536
END IF
’Range = 256*256
PRINT #4, "Y Unit
, ";
IF Y.Unit = 1 THEN PRINT #4, "V"
IF Y.Unit = 2 THEN PRINT #4, "A"
IF Y.Unit = 3 THEN PRINT #4, "Ohm"
IF Y.Unit > 3 OR Y.Unit = 0 THEN PRINT #4, "No print"
PRINT #4, "Y Label
,";
IF Y.Unit = 1 THEN PRINT #4, Y.Scale; "V/Div"
IF Y.Unit = 2 THEN PRINT #4, Y.Scale; "A/Div"
IF Y.Unit = 3 THEN PRINT #4, Y.Scale; "Ohm/Div"
IF Y.Unit > 3 OR Y.Unit = 0 THEN PRINT #4, Y.Scale; "No print"

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.Value; ","; Amplit.Value; ",";
ELSEIF MinMax.Flag = 1 THEN
MinMax.Flag = MinMax.Flag - 1
PRINT #4, Amplit.Value; ",";
ELSE
MinMax.Flag = 2
PRINT #4, Amplit.Value
Time.Value = Time.Value + X.Resol
END IF
END IF
IF MinMax.Samples = 1 THEN
’Min/Max waveform
IF MinMax.Flag = 1 THEN
MinMax.Flag = 0
PRINT #4, Time.Value; ","; Amplit.Value; ",";
ELSE
MinMax.Flag = 1
PRINT #4, Amplit.Value
Time.Value = Time.Value + X.Resol
END IF
END IF
IF MinMax.Samples = 0 THEN
’Single waveform
PRINT #4, Time.Value; ","; Amplit.Value
Time.Value = Time.Value + X.Resol
END IF
NEXT i
CLOSE #4: RETURN
’
’****************** End example program ******************

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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

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.

Example:
The following example resets the instrument and waits for 2
seconds to let the instrument execute the reset and become
ready for next commands.
The instrument is queried for the identification data; this
data is input and displayed on the PC screen.

’

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.
PRINT IDENT$
’Displays queried data.
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. 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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******* Clears pending data from the RS232 port *********
ClearPort:
WHILE LOC(1) > 0
Dummy$ = INPUT$(1, #1)
WEND
RETURN
’******************

End example program

******************

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.

Command Syntax:
RS 
where,
 =
1 to 10
: Screen/Setup memories

Response Syntax:

Note: The new setup is active when you have received the
 response from the instrument.

Example:
The following example program saves the present setup in
setup memory 8. You are requested to change the present
settings. Then the original settings are recalled from
setup memory 8 and made the actual setting.

’
’*****************

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."
PRINT "To test if this works, change the present settings"
PRINT "and verify if the instrument returns to the original"
PRINT "settings after continuing the program."
PRINT
PRINT "Press any key on the PC keyboard to continue."
SLEEP
PRINT #1, "RS 8"
’Sends RECALL SETUP command.
’Setup recalled from register 8.
GOSUB Acknowledge
’Input acknowledge from instrument.
PRINT
PRINT "Original settings restored"
CLOSE #1
END
’

’

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.
IF ACK <> 0 THEN
PRINT "Error "; ACK; ": ";
SELECT CASE ACK
CASE 1
PRINT "Syntax Error"
CASE 2
PRINT "Execution Error"
CASE 3
PRINT "Synchronization Error"
CASE 4
PRINT "Communication Error"
CASE IS < 1
PRINT "Unknown Acknowledge"
CASE IS > 4
PRINT "Unknown Acknowledge"
END SELECT
PRINT "Program aborted."
END
END IF
RETURN
’******************

End example program

******************

Page 3.69
=============================================================
READ TIME
RT
------------------------------------------------------------Purpose:
Reads the real time clock time settings.

Command Syntax:
RT

Response Syntax:
[

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
Create Date                     : 2002:02:06 16:32:59
Producer                        : Acrobat Distiller 4.0 for Windows
Creator                         : Windows NT 4.0
Title                           : Microsoft Word - Fluke43_B_.txt
Modify Date                     : 2002:02:06 08:02:08-08:00
Page Count                      : 116
EXIF Metadata provided by EXIF.tools

Navigation menu