Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

ni-daqmx using vb6

Hi

iam trying to connect ni-daqmx to vb6 and here is my code.

 

 Sub temp1()


Dim mytask As Long
Dim Data(1000) As Double

DAQmxErrChk DAQmxLoadTask("temp1", mytask)
DAQmxErrChk DAQmxReadAnalogF64(mytask, 1000, 10, DAQmx_Val_GroupByChannel, Data(0), 1000, 1000, ByVal &O0)


Text14.Text = Data(1) ' for displaying data in textbox
Text14.Text = Format(Text14.Text, "#00.00") ' making 2decimal digit


DAQmxErrChk DAQmxStopTask(mytask)
DAQmxErrChk DAQmxClearTask(mytask)

Exit Sub
errorhandler:
DAQmxStopTask mytask
DAQmxClearTask mytask
MsgBox Err.Description

End Sub

 

Private Sub cmd_acquire_Click()
Timer1.Enabled = True
Timer1.Interval = 60000 ' setting 1minute
End Sub

Private Sub Form_Load()
Timer1.Enabled = fasle

End Sub

Private Sub Timer1_Timer()
temp1
End Sub

 

like wise i have 8-10 task whih diplays the temperature value in text14 to text22

 

using timer iam calling this function for every 1 minute ,

 

iam getting data but as time progresses the data capture is getting delayed means initialy it will execute at 1minute

after say 1or two hours the capturing is getting delayed by 30-40 sec.

 

iam using scxi chasi with temperature module. using task iam calling in to my vb application.

 

iam unable ti figure out the route problem for time delay.

 

Regards

 

Raj

 

 

 

 

 

 

0 Kudos
Message 1 of 5
(6,608 Views)

Hey Raj,

 

Does the program run continously for 1 hour and then you experience the delay? Or is it just that the program sometimes takes 1 minute to capture everything it is suuposed to when it is run, and sometimes it takes more?

Regards,

Sahil Singla
Applications Engineer | National Instruments

(Give Kudos to good Answers and Mark it as a Solution if your problem is Solved)
0 Kudos
Message 2 of 5
(6,597 Views)

hi Sahil

 

the programme run continuosly for 2 1/2 hours ,

and the aquire is programmed for 1 minutes so every one minute the data refreshes .

 

initial within 2-3 minutes the data refreshes bang on time but as time progressses the data capture is adding delay

in geting data

after 30 minutes 6-8 sec delay

after 2 hours 25-30 sec

and at 21/2 hour there will be delay of 35-40 sec.

 

iam using scxi 1ith 1303 temperature module.

 

regards

raj

 

 

0 Kudos
Message 3 of 5
(6,591 Views)

Hello Raj,

 

Yes, so since the program runs continuously, and the Windows OS is not deterministic unlike Real-Time OS which is deterministic, the processor usage builds up and it slows down on continuous run of the LabVIEW application, so the time taken increases down the line. This kind of behaviour is expected and can not be avoided on the PC.

Regards,

Sahil Singla
Applications Engineer | National Instruments

(Give Kudos to good Answers and Mark it as a Solution if your problem is Solved)
0 Kudos
Message 4 of 5
(6,588 Views)

Hi sahil

 

I know windows is not real time operating system, it has got some delay which will be interms of milisecond or seconds .

 

i have set the task (temp1) to n-sample mode not on continuos mode.

so task exectes @ 1 minute interval.

the task is working fine in Ni-daqmx.every time i run the datas are geting in no time.

 

iam calling these tasks in my vb6 application, there i have problem execution of task getting delayed as time passes.

 

Regards

 

raj

 

0 Kudos
Message 5 of 5
(6,586 Views)