PDA

View Full Version : Default Splashscreen Image Remains with Continuous Sampling (Must Finite Sample)


mhead10
09-19-2012, 09:10 AM
I'm currently obtaining continuous data from my USB DAQ. My splashscreen will not show the background I have prepared for it until all of my DAQ data has loaded (ie- I haven't figured out how to load my graphics if I use continuous sampling. If I have finite sampling, then the graphics will load after all samples have been taken).

How can I have continuous sampling with what I programmed into the viz.go window? I put viz.go() at the beginning of my program, so obviously there is something else that needs to occur before I can actually start viewing and interacting with the window.

I will attach relevant code below.

Thanks

import ctypes
import numpy
import viztask
nidaq = ctypes.windll.nicaiu # load the DLL
viz.go()

# constant and variables left out for simplicity

def CHK(err):
if err < 0:
buf_size = 100
buf = ctypes.create_string_buffer('\000' * buf_size)
nidaq.DAQmxGetErrorString(err,ctypes.byref(buf),bu f_size)
raise RuntimeError('nidaq call failed with error %d: %s'%(err,repr(buf.value)))

#Main Program
CHK(nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle)))
CHK(nidaq.DAQmxCreateAIVoltageChan(taskHandle,"Dev2/ai0:1","",DAQmx_Val_Cfg_Default,float64(-13.0),float64(13.0),DAQmx_Val_Volts,None))
CHK(nidaq.DAQmxCfgSampClkTiming(taskHandle,"",float64(1),DAQmx_Val_Rising,DAQmx_Val_ContSamps,u Int64(max_num_samples)));
CHK(nidaq.DAQmxStartTask(taskHandle))

def obtain_value():
CHK(nidaq.DAQmxReadAnalogF64(taskHandle,1,float64(-1),DAQmx_Val_GroupByChannel,data.ctypes.data,max_n um_samples,ctypes.byref(read),None))
print ' after read'
print data

i = 0
while i < 10:
i += 1 # IF I COMMENT THIS LINE OUT, MY SPLASHSCREEN WILL NOT LOAD :(
obtain_value()

if taskHandle.value != 0:
CHK(nidaq.DAQmxStopTask(taskHandle))
CHK(nidaq.DAQmxClearTask(taskHandle))

mhead10
09-20-2012, 01:48 PM
viz.directormode(viz.DIRECTOR_FAST)

did not seem to change anything either yet...

mhead10
09-21-2012, 07:11 AM
viz.director() solved the problem