Programming examples gpib operation – Anritsu ML2430A User Manual

Page 215

Advertising
background image

6-16

PROGRAMMING
EXAMPLES

The following programming examples are provided as a general guideline on how
to program the ML2430A Series Power Meters using GPIB commands. All exam-
ples are written in Visual Basic or C language. The GPIB-specific calls are for the
National Instruments GPIB DLL.

Refer to the IEEE 488.2-1987 Programming Reference book for more information
about how to use the 488.2 commands.

Output Data

Function GetReading (ByVal channel As Integer) As Single

'

make space for the result

Dim result As String
result = String$(10, 0)

'

Set the command up

Cmd = “O ” + Str(channel) : CmdLength = Len(Cmd)

'

Send the command to the device at address 13

'

(default address of the power meter)

Call DLLsend(0, 13, Cmd, CmdLength, NLend, ibsta%,
iberr%, ibcntl&)

'

Receive the data from ML2430A at address 13

Call DLLreceive(0, 13, result, 10, STOPend, ibsta%,
iberr%, ibcntl&)

'

Pass result back

GetReading = Val(result)

End Function

6-128

ML2430A OM

PROGRAMMING EXAMPLES

GPIB OPERATION

Advertising