Programming Examples GPIB Operation
8-132 PN: 10585-00001 Rev. P ML2437A/38A OM/PM
8-14 Programming Examples
The following programming examples are provided as a general guideline on how to program
the ML243xA Power Meters using GPIB commands. All examples 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