WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 20 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-13-2012, 09:49 AM
mhead10 mhead10 is offline
Member
 
Join Date: Mar 2012
Posts: 40
If I run a while loop (to obtain my DAQ data), the maximum number of times the loop will run is 4. After 4 times, "after start task" is displayed, but then nothing else. Therefore, it seems every time the loops gets stuck on the read function.

Any ideas?

I continue to move around what's inside of the function obtain_value, as well as change # of samples and sampling frequency.

Here is the code I'm referring to:

Code:
def obtain_value():
    print 'entered main program'
    CHK(nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle)))
    print ' after create task'
    CHK(nidaq.DAQmxCreateAIVoltageChan(taskHandle,"Dev2/ai0:1","",DAQmx_Val_Cfg_Default,float64(-13.0),float64(13.0),DAQmx_Val_Volts,None))
    print '  after create voltage'
    CHK(nidaq.DAQmxCfgSampClkTiming(taskHandle,"",float64(50),DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,uInt64(max_num_samples))); #(samples/sec/channel)  #ContSamps    
    print '   after clk'
    CHK(nidaq.DAQmxStartTask(taskHandle))
    print '    after start task'
    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
    if taskHandle.value != 0:
        nidaq.DAQmxStopTask(taskHandle)
        nidaq.DAQmxClearTask(taskHandle)   
    print '      end'

i = 0
while i < 5:
    i += 1
    print i
    obtain_value()
Reply With Quote
 


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


All times are GMT -7. The time now is 05:10 AM.


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