WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-19-2012, 09:10 AM
mhead10 mhead10 is offline
Member
 
Join Date: Mar 2012
Posts: 40
Default Splashscreen Image Remains with Continuous Sampling (Must Finite Sample)

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

Code:
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),buf_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,uInt64(max_num_samples))); 
CHK(nidaq.DAQmxStartTask(taskHandle))

def obtain_value():
    CHK(nidaq.DAQmxReadAnalogF64(taskHandle,1,float64(-1),DAQmx_Val_GroupByChannel,data.ctypes.data,max_num_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))
Reply With Quote
  #2  
Old 09-20-2012, 01:48 PM
mhead10 mhead10 is offline
Member
 
Join Date: Mar 2012
Posts: 40
Code:
viz.directormode(viz.DIRECTOR_FAST)
did not seem to change anything either yet...
Reply With Quote
  #3  
Old 09-21-2012, 07:11 AM
mhead10 mhead10 is offline
Member
 
Join Date: Mar 2012
Posts: 40
HTML Code:
viz.director()
solved the problem
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Animated Splashscreen hosier Vizard 5 06-10-2010 10:58 AM


All times are GMT -7. The time now is 01:22 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC