Section 6: Instrument programming
2606B System SourceMeter® Instrument Reference Manual
6-56
2606B-901-01 Rev. B / May 2018
Removing stale values from the reading buffer cache
The node that acquires the data also stores the data for the reading buffer. To optimize data access,
all nodes can cache data from the node that stores the reading buffer data.
When you run Lua code remotely, it can cause reading buffer data that is held in the cache to
become stale. If the values in the reading buffer change while the Lua code runs remotely, another
node can hold stale values. Use the
clearcache()
command to clear the cache. For additional
detail on the reading buffer cache commands, see
(on page 7-17) and
(on page 7-19).
The following example code demonstrates how stale values occur and how to use the
clearcache()
command to clear the cache on node 2, which is part of group 7.
-- Create a reading buffer on a node in a remote group.
node[2].tsplink.group = 7
node[2].execute("rbremote = smua.makebuffer(20)" ..
"smua.measure.count = 20 " ..
"smua.measure.v(rbremote)")
-- Create a variable on the local node to
-- access the reading buffer.
rblocal = node[2].getglobal("rbremote")
-- Access data from the reading buffer.
print(rblocal[1])
-- Run code on the remote node that updates the reading buffer.
node[2].execute("smua.measure.v(rbremote)")
-- Use the clearcache command if the reading buffer contains cached data.
rblocal.clearcache()
-- If you do not use the clearcache command, the data buffer
-- values will never update. Every time the print command is
-- issued after the first print command, the same data buffer
-- values will print.
print(rblocal[1])
TSP-Net
The TSP-Net
®
library allows the 2606B to control LAN-enabled devices directly through its LAN port.
This enables the 2606B to communicate directly with a device that is not TSP
®
enabled without the
use of a controlling computer.
TSP-Net capabilities
The TSP-Net library permits the 2606B to control a remote instrument through the LAN port for both
Test Script Processor (TSP
®
) and non-TSP instruments. Using TSP-Net library methods, you can
transfer string data to and from a remote instrument, transfer and format data into Lua variables, and
clear input buffers. The TSP-Net library is only accessible using commands from a remote command
interface.
You can use TSP-Net commands to communicate with any ethernet-enabled instrument. However,
specific TSP-Net commands exist for TSP-enabled instruments to allow for support of features unique
to the TSP scripting engine. These features include script downloads, reading buffer access, wait
completion, and handling of TSP scripting engine prompts.