02-26-2018 03:37 AM
Hello,
I have several USB-6003 units that I would like to record analog input on while the digital output ports arbitrarily actuate various relays. Nothing fancy or high frequency- I just want a simple, repeatable "switch" control using the digital outputs as I record.
I'm using SignalExpress and I can't for the life of me figure out this simple task:
1) Dev1 Port 0 Line 0, at t=2 seconds, write High
2) Dev1 Port 0 Line 0, at t=3 seconds, write Low
If I can accomplish that, I can do the rest.
I tried it two different steps, but I got an error -200587 (presumably because two different steps are using the same channel).
I tried to choose "Programmable Input" and Create a Signal, but keep getting "Missing Input".
Does anyone know how I can accomplish what I'd like to do?
02-27-2018 09:11 AM
Hello jayache80:
Have you tried with this same idea using counters or a digital signal?
03-16-2018 12:10 AM
Thanks for your reply. I tried with a digital signal but I could never get it properly routed to the task. I did not try counters.
I ended up using the python wrapped DAQmx API which is a life saver for what I'm doing. I'm very happy NI has been working on that, because it is just so much easier than doing it in C. Bravo to those working on that!
I will probably never open SignalExpress again, especially after it started closing itself after so many minutes (I bought the DAQ, I gotta buy the software too?)
Here's an SSCCE:
import nidaqmx from nidaqmx.constants import ( LineGrouping, TerminalConfiguration, VoltageUnits, AcquisitionType ) import time system = nidaqmx.system.System.local() print(system.driver_version) for device in system.devices: print(device) with nidaqmx.Task("actuator_task") as actuator, nidaqmx.Task("reader_task") as reader: actuator.do_channels.add_do_chan( "Dev1/port0/line0:7", line_grouping=LineGrouping.CHAN_FOR_ALL_LINES ) reader.ai_channels.add_ai_voltage_chan( "Dev1/ai0:7", terminal_config=TerminalConfiguration.RSE, min_val=-5.0, max_val=5.0, units=VoltageUnits.VOLTS, ) reader.in_stream.configure_logging( r"c:\recording.tdms", nidaqmx.constants.LoggingMode.LOG) # samps_per_chan is buffer size in CONTINUOUS mode # if in FINITE mode, samps_per_chan is number of samples to acquire reader.timing.cfg_samp_clk_timing( rate=1000, sample_mode=AcquisitionType.CONTINUOUS, samps_per_chan=2048, ) # write all high actuator.write(0b11111111, auto_start=True) # start recording reader.start() time.sleep(1) # write channels 0-2 as high, the rest lows actuator.write(0b11100000, auto_start=True) time.sleep(1) # write channels 0-2 as low, the rest high actuator.write(0b00011111, auto_start=True) time.sleep(1) # stop recording reader.stop()