01-31-2019 10:51 AM
I am trying to generate a ARB waveform with the FGEN and start the adquision of the SCOPE at the same time. It doesn't work because look like the SCOPE never triggers and at the end there is a timeout error.
I enclose the demo code that should reproduce my problem. Is there any similar code example or someone could point out what I am doing wrong?
Thanks!
import nifgen
import niscope
from nifgen import enums
from niscope import enums as scope_enums
options = {'simulate': False, 'driver_setup': {'Model': '5433 (2CH)', 'BoardType': 'PXIe', }, }
fgen = nifgen.Session(resource_name='FGEN', options=options)
fgen.abort()
# prepare the scope to be triggered with the exported trigger from the FGEN
scope = niscope.Session(resource_name='SCOPE')
scope.channels[0].configure_vertical(range=4, coupling=niscope.VerticalCoupling.DC)
scope.configure_trigger_digital("PXI_Trig0", slope=scope_enums.TriggerSlope.POSITIVE)
scope.configure_horizontal_timing(min_sample_rate=int(60e6), min_num_pts=180000,
ref_position=50.0, num_records=1, enforce_realtime=True)
scope.initiate()
# generate a WAVEFORM
sample_rate = 10E6
waveform = []
for i in range(0, 1000):
waveform.append(i/1000)
fgen.output_mode = nifgen.OutputMode.ARB
fgen.channels[0].arb_sample_rate = sample_rate
fgen.channels[0].trigger_mode = enums.TriggerMode.SINGLE
waveform_handle = fgen.create_waveform(waveform_data_array=waveform)
fgen.exported_start_trigger_output_terminal = "PXI_Trig0"
fgen.arb_waveform_handle = waveform_handle
fgen.streaming_waveform_handle = waveform_handle
fgen.channels[0].configure_arb_waveform(waveform_handle=waveform_handle, gain=2, offset=0)
fgen.initiate()
while fgen.is_done() is False:
pass
wfm = scope.channels[0].fetch(num_samples=180000)
wfm = list(wfm[0].samples)
print('Number of samples acquired: {:,}\n'.format(len(wfm)))
fgen.abort()
scope.abort()
02-01-2019 09:39 AM
Hi ihouses,
can you please tell us what scope you are using?
Best,
Melanie
02-01-2019 02:24 PM
Hello,
I have a scope NI PXIe-5105, and I want to trigger capture and read channel 0
02-04-2019 05:02 AM
Hi ihouses,
concerning the Specifications document of the PXIe 5105 the device only supports a Reference Stop Trigger:
PXIe-5105 Specifications - PXI Oscilloscope Manual - National Instruments
http://www.ni.com/documentation/en/pxi-oscilloscope/latest/specs-pxie-5105/specs/
You should get an error message as sson as you configure the trigger setting for the scope or when you start the scope telling you the start trigger is an unsupported feature for your scope.
Best,
Melanie
02-04-2019 09:25 AM
Hello,
As you can see in the code I am using the digital trigger. That is specified in the like that you provide:
Trigger type |
Digital |
Sources |
PFI 1 (front panel SMB connector) PXI_TRIG <0..6> (backplane connector) |
I my case I use PXI_TRIG0
I don't know anything about the reference stop trigger.
02-08-2019 09:48 AM
Well, that's embarrassing but suddenly the script works in my setup. May be is because I reset the machine or so. So thanks for the support.