7
is available for download from Keithley web site:
www.keithley.com
IVI Program
The following is the init command to use when connecting to the Model 2701 with the IVI Driver. When using multiple Model 2701s in the same program, each instrument
must be opened using a different instrument handle.
InstrumentName = “TCPIP::192.68.1.10::1394::
SOCKET”
‘Connect to the instrument
‘Open Session
CheckError vi, KE2700_init(InstrumentName,
VI_TRUE, VI_TRUE, vi)
The next step is to configure the instrument to make a
temperature measurement in degrees Fahrenheit and set up
the scan list.
‘ Configure for Fahrenheit
CheckError vi, KE2700_SetAttributeViInt32(vi,
VI_NULL, KE2700_ATTR_TEMP_UNIT, KE2700_
VAL_TEMP_FAHRENHEIT)
CheckError vi,
KE2700_ConfigureMeasurement(KE2700_
ChannelList(vi, “101:105”), KE2700_VAL_
TEMPERATURE, KE2700_VAL_TEMP_TC_K,
0.001)
‘ Configure buffer
‘ Select Buffer Elements: Readings, Channel#
CheckError vi, KE2700_SetAttributeViInt32(vi,
VI_NULL, KE2700_ATTR_BUF_ELEMENTS,
KE2700_VAL_ELEMENT_READING +
KE2700_VAL_ELEMENT_CHAN) ‘
‘Enable the auto buffer Clear
CheckError vi, KE2700_SetAttributeViBoolean(vi,
VI_NULL, KE2700_ATTR_BUF_AUTO_
CLR_ENABLED, VI_TRUE)
‘ Enable Buffer as Next
CheckError vi, KE2700_SetAttributeViInt32(vi,
VI_NULL, KE2700_ATTR_BUF_DATA_CONTROL,
KE2700_VAL_CONTROL_NEXT)
CheckError vi, KE2700_ConfigureTrigger(vi, KE2700_
VAL_TIMER, 0.001)
‘ Set internal Timer to 2 sec
CheckError vi, KE2700_SetAttributeViReal64(vi,
VI_NULL, KE2700_ATTR_TIMER_INTERVAL, 2)
The following commands will start the scan when executed. Notice the trigger count (100) and the sample count (5)
values in the second line. Those numbers mean that when the
scan is started, the scan will execute 100 times and each time
will take five samples, one sample for every channel in the
scan list. When determining the appropriate trigger count and
sample count values, be careful not to exceed the number of
samples the buffer can hold. When 100 triggers are multiplied
by the sample count, each completed scan represents 500
readings in the internal buffer . Also, when storing the channel
number with the readings, be aware that this doubles the
amount of buffer space each reading occupies. In this example, the number of readings in the buffer increases from 500
to 1000. The Model 2701 buffer can hold 450,000 readings.
‘ Start Scan
CheckError vi, KE2700_ConfigureMultiPoint(KE2700_
ChannelList(vi, “101:105”), 100, 5, KE2700_VAL_
IMMEDIATE, 0#)
CheckError vi, KE2700_Initiate(vi)
The following buffer commands will copy the data stored
in the internal buffer to the Array called Data. In the
FetchMultiReading command, note that 0 is the starting position of the buffer from which readings are to be copied. The
pointer value is the maximum number of readings that are to
be copied to the array. The pointer variable is used because
that is the value of the last reading as returned by the
KE2700_ATTR_BUF_POINTER_LOCATION. This is useful if it’s desirable to read the buf fer again and return only the
readings acquired since the last time the buffer was read. The
new start position will then be pointer +1.
‘ Get data from buffer
CheckError vi, KE2700_GetAttributeViInt32(vi,
VI_NULL, KE2700_ATTR_BUF_POINTER_
LOCATION, pointer)
‘ Get the buffer readings. Must have the starting index
in the array or program will bomb out
CheckError vi, KE2700_FetchMultiReading(vi, 0,
pointer, pointer, data(0), retSize)
Example using Winsock control
This example will use the Winsock control included in Visual Basic to send SCPI commands directly to the Model 2701
using the TCP/IP protocol. This type of programming doesn’t require installing any driver to use with the Model 2701.
The Winsock control acts much like the MSComm object in
Visual Basic, but it has added features like the data arrival
event. When using serial communications, it is common to
poll the data as it arrives in order to detect the end of line
character to identify the data transmission is complete.
Rather than polling the data as it comes back, the Winsock
control has the data arrival event, which fires when data is