Пример #1
0
def relativeTo(task,newval=None):
    """
    newval may be either DAQmx_Val_FirstSample 10424
    or
    DAQmx_Val_CurrWritePos (10430)
    """
    if not newval:
        val = mx.uInt64(0)
        mx.ni.DAQmxGetWriteRelativeTo(task, byref(val))
        return val.value
    else:
        mx.CHK(mx.ni.DAQmxSetWriteRelativeTo(task,newval))
Пример #2
0
def getCurWritePos(task):
    cur_wp = mx.uInt64(0)
    mx.CHK(mx.ni.DAQmxGetWriteCurrWritePos(otask, byref(cur_wp)))
    return cur_wp.value
Пример #3
0
# get_regeneration

otask = nidaqmx.AnalogOutputTask()

otask.create_voltage_channel(analog_output_term, min_val=-10.0,max_val=10.0)

otask.configure_timing_sample_clock(source=r'ai/SampleClock',
                                    rate=samplerate,
                                    sample_mode=samplemode,
                                    samples_per_channel=nsamples)

otask.write(outputdata,auto_start=False)


# start them both
cur_wp = mx.uInt64(0)
otask.start()
itask.start()
d1=itask.read(samples_per_channel=500)
time.sleep(1.0)
print "current read position", itask.get_read_current_position()
mx.ni.DAQmxGetWriteCurrWritePos(otask, byref(cur_wp))
otask.write(output2)
after = getCurWritePos(otask)
time.sleep(0.1)
# d2 = itask.read(samples_per_channel=500)
# itask.wait_until_done(10.0)
# print "otask.get_bufsize()",otask.get_bufsize()
print "before cur_wp:",cur_wp.value, "and after:", after
print "relativeTo:", relativeTo(otask)
print "done"