Hello everyone,
I tried to generate a sine wave output on an analog output from my NI-USB 6216 module with nidaqmx. This code is what I have done but it doesn't work...
import nidaqmx
import numpy as np
from nidaqmx.stream_writers import AnalogSingleChannelWriter
SamplesPerSignal = 1000
SignalFrequency = 1000
NumberOfCycles = 100000000
Amplitude=2
w=2*np.pi*SamplesPerSignal
Sample = np.linspace(0,SamplesPerSignal,num=SamplesPerSignal)
Signal= np.sin(Sample*w)*Amplitude
with nidaqmx.Task() as task:
task.ao_channels.add_ao_voltage_chan("Dev1/ao0")
task.timing.cfg_samp_clk_timing(rate=SignalFrequency*SamplesPerSignal,sample_mode=nidaqmx.constants.AcquisitionType.CONTINUOUS,samps_per_chan=SamplesPerSignal*NumberOfCycles)
SignalStreamer = nidaqmx.stream_writers.AnalogSingleChannelWriter(task.out_stream, auto_start=True)
SignalStreamer.write_many_sample(Signal)