Posted Tue, 11 Jun 2024 15:31:05 GMT by L, Georg
I found a very usefull example how to perform measurements and transfer data: 

https://github.com/tektronix/keithley/tree/main/Instrument_Examples/DMM7510/Stream_Digitized_Measurements/Sockets/Single_Box

Python
def get_block(my_socket, chunk_size, buffer_size):
    # This function extracts the binaray floating point data
    # from the DMM7510.
    sndStr = "get_data({0})\n".format(buffer_size)
    my_socket.send(sndStr.encode())
    response = my_socket.recv(1024)
    # New content....
    fmtStr = '%df' % chunk_size
    altResp = struct.unpack(fmtStr, response[2:-1])
    return altResp

TSP
function get_data(buffSize)
    chunker = 249
    --while buffer.getstats(defbuffer1).n - readings_captured < 200 do
    while (buffer.getstats(defbuffer1).n - readings_captured) < chunker do
        delay(0.001)
    end
    local index1 = math.mod(readings_captured, buffSize) + 1
    local index2 = index1 + (chunker - 1)            -- was 199
    if index2 > buffSize then
        index2 = buffSize
    end
    --print(scpi.execute(':TRAC:DATA? ' .. index1 .. ', ' .. index2 .. ', \"defbuffer1\"'))
    printbuffer(index1, index2, defbuffer1.readings)
    readings_captured = readings_captured + chunker
end

How shall I change those blocks to get relativetimestamps as well?
Posted Thu, 01 Aug 2024 10:31:12 GMT by C, Andrea
The printbuffer() can take multiple buffer elements:
printbuffer(index1, index2, defbuffer1.readings, defbuffer1.relativetimestamps)

This well result in comma delimited reading, time, reading, time, etc according to the index values.
The receiving code will need to parse it.

You must be signed in to post in this forum.