Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

fca3000 can't set continuos measurement for both channel

Programming examples for remote communication with instruments
C/C++, C#, Python, Matlab, LabVIEW
Post Reply
Michael Piran
Posts: 1
Joined: October 9th, 2018, 6:19 am
Country: Italy

fca3000 can't set continuos measurement for both channel

Post by Michael Piran » October 9th, 2018, 7:39 am

Hi :) ,
In my Python program, I would continuos read two frequency from a Tektronix fca3000 and later I would plot them. I comunicate with a USB interface.
Thank's to totalize[Contiuos], I can read a continuos measurement on channe1 (or A). When I try the same scripts for channel 2 the instruments continue read from channel 1.
What's the problem? Fca3000 can't read continuosly from two channel?

Code: Select all

import visa
from matplotlib import pyplot as plt
import matplotlib.animation as animation
import numpy as np

rm = visa.ResourceManager()
inst = rm.open_resource('USB::0x0699::0x3000::170411::INSTR')
inst.timeout = 20000

aperture = inst.query_ascii_values('FREQuency:BURSt:APERture?')
inst.write('CONFigure:ARRay:FREQuency:BURSt 2000')
inst.write('FORMat:TINFormation ON')

inst.write('CONFIGURE:TOTALIZE[:CONTINUOUS] (@1)') #continuos measure on ch.A
inst.write('INIT:CONT ON')
inst.write('TOT:GATE ON')

data = []
def data_gen(tzero_f = 1):
    while True:
        isFreq = 1
        data = inst.query_ascii_values('FETCH:ARRay? -2')#fetch the last 2 value
        for value in data:
            if isFreq==1:
                #req = value * (60 / 360); # RPM
                freq = value
                isFreq = 0 
                if tzero_f==1:
                    tzero_f = 0
                time = value-timezero
                isFreq = 1                
        yield time,freq
def init():
    ax.set_xlim(0, 10)
    del xdata[:]
    del ydata[:]
    line.set_data(xdata, ydata)
    return line,

fig = plt.figure()
ax = fig.add_subplot(1,1,1)
line, = ax.plot([], [], lw=2)
plt.xlabel('time (s)')

xdata, ydata = [], []

def run(data):
    # update the data
    t, y = data
    xmin, xmax = ax.get_xlim()
    ymin, ymax = ax.get_ylim()
    if t >= xmax:
        ax.set_xlim(xmin, 2*xmax)
    if y >= ymax:
        ax.set_ylim(ymin, 2*ymax)
    line.set_data(xdata, ydata)
    return line

ani = animation.FuncAnimation(fig, run, data_gen, blit=False, interval=10,
                              repeat=False, init_func=init)

Carl M
Tektronix Applications
Tektronix Applications
Posts: 800
Joined: July 30th, 2008, 4:45 pm
Country: United States

Re: fca3000 can't set continuos measurement for both channel

Post by Carl M » November 7th, 2018, 10:36 am

be sure to check the event status register (*esr?) to check for errors on the instrument end. if the reply is non-zero, read the event messages with system:error? until the instrument replies "no error"
Tektronix Application Engineer

Post Reply

Return to “Remote Instrument Communication (Programming) Examples”

Who is online

Users browsing this forum: No registered users and 4 guests