Example Of Normal Measurement Data Output - YOKOGAWA PZ4000 User Manual

Power analyzer communication interface
Hide thumbs Also See for PZ4000:
Table of Contents

Advertisement

6.2 Example of Normal Measurement Data Output

'***********************************************************************
'*
'*
'*
'*
'***********************************************************************
'*
'*
'*
'*
'*
'*
'*
'*
'*
'*
'***********************************************************************
'
REM $INCLUDE: 'qbdecl4.bas'
'
OPTION BASE 1
DIM D$(40)
'
DEVICE$ = "DEV1": CALL IBFIND(DEVICE$, PZ%)
CALL IBSIC(PZ%)
BORD$ = "GPIB0": CALL IBFIND(BORD$, BD%)
CALL IBSIC(BD%)
V% = 1: CALL IBSRE(BD%, V%)
'
' Set the measurement condition and range
CMD$ = "SETUP:MODE NORMAL"
CALL IBWRT(PZ%, CMD$)
CMD$ = "VOLTAGE:RANGE 200"
CALL IBWRT(PZ%, CMD$)
CMD$ = "CURRENT:RANGE 4"
CALL IBWRT(PZ%, CMD$)
CMD$ = "FILTER:LINE OFF"
CALL IBWRT(PZ%, CMD$)
CMD$ = "TIMEBASE:OBSERVE 100MS" ' Observation time = 100msec
CALL IBWRT(PZ%, CMD$)
'
' Set the numerical data output items (ASCII format, preset to pattern 1, number of
output data = 40)
CMD$ = "NUMERIC:FORMAT ASCII;NORMAL:PRESET 1;NUMBER 40"
CALL IBWRT(PZ%, CMD$)
'
' Set the transition filter used to detect the completion of the numerical data updating
CMD$ = "STATUS:FILTER2 RISE"
CALL IBWRT(PZ%, CMD$)
' Clear the extended event register(Read and trash the response)
CMD$ = "STATUS:EESR?"
CALL IBWRT(PZ%, CMD$)
RG$ = SPACE$(8)
CALL IBRD(PZ%, RG$)
'
' Measurement start
CMD$ = "START"
CALL IBWRT(PZ%, CMD$)
'
' Read and display the numerical data (Repeated 10 times in this program)
FOR I% = 1 TO 10
6-2
PZ4000 Sample Program1 for GP-IB interface
In the normal measurement mode, set the measurement conditions
and start the measurement.
The following numerical data (ASCII format) are read and displayed *
on every update.
voltage (Urms), current (Irms), active power (P),
apparent power (S), reactive power (Q), power factor (λ),
phase difference (φ), voltage frequency (fU),
current frequency (fI)
' Minimum value of array subscript = 1
' Array of numerical data strings
' Current range = 4Apk
' Line filter = OFF
' Wait for the completion of the numerical data updating
CMD$ = "COMMUNICATE:WAIT 2"
CALL IBWRT(PZ%, CMD$)
' Clear the extended event register (Read and trash the response)
CMD$ = "STATUS:EESR?"
CALL IBWRT(PZ%, CMD$)
RG$ = SPACE$(8)
CALL IBRD(PZ%, RG$)
'
' Read out numerical data
CMD$ = "NUMERIC:NORMAL:VALUE?"
CALL IBWRT(PZ%, CMD$)
RES$ = SPACE$(1000)
CALL IBRD(PZ%, RES$)
'
' Extract items that are separated by commas (,) from the received numerical data
C$ = LEFT$(RES$, IBCNT%)
FOR J% = 1 TO 40
L% = LEN(C$)
B% = INSTR(C$, ",")
IF B% = 0 THEN B% = L% + 1
D$(J%) = LEFT$(C$, (B% - 1))
C$ = MID$(C$, (B% + 1))
NEXT J%
Microsoft QuickBASIC 4.0/4.5 Version
' Remote setting
' Normal measurement mode
' Voltage range = 200Vpk
' Rising edge of bit1 (DAV)
' IBCNT% = Number of received bytes
*
*
*
*
*
*
*
*
*
*
*
*
*
IM 253710-11E

Advertisement

Table of Contents
loading

Table of Contents