Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CompactDaq AI with Visual Basic .NET

I can't help you with the Access portion of your requests because I have always struggled with databases, but I can give you a few pointers for 1 Hz programs.

I have a timer object with an interval of 1 Hz.
At each Timer_Tick, I call a thread with RealTime priority.  This level of priority isn't recommended because it may make the OS unstable, but my code generally takes <200 ms per second so there is plenty of time left over for other processes.
I used to handle all of the tasks in the loop_tick event, but Threads run MUCH smoother.

Following NI's example for continuous analog input would be a good start.  I used to do FiniteSamples, but through this thread I learned the most efficient way to handle analog input. 

I'd start small.  Write a program that reads and displays the data in text boxes.
Then make it write to a text file.
Then make it write to a database.

You will find good documentation on continuous analog input in the Measurement Studio help files.  I'm sure you will come up with some more specific questions as you go along.  Right now it sounds like you haven't started and you haven't really come up with an architecture for your application.

Good applications come from good design, so start with some block diagrams and flowcharts.  Then move into coding.
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 111 of 115
(1,504 Views)
Hi micheal, i appreciate your response, i really have started something but the fact remain that i cant even make the task to display its result in the textbox control i created. hence i can't even tell if it runs. Also i checked out the example chipped with Measurement studio and cant find any with result displayed in Textbox.
 
I will appreciate a code that will do a Ten Channels continous acquisition using a NI-6023E, when a task is called. the input voltage is -5 minimumVolt and +5 MaximumVolt,using Bbl as Units.
 
Cheers
 
Charlion    
0 Kudos
Message 112 of 115
(1,500 Views)
Data is returned as a two dimensional array.  You will need to extract data from that array by either pulling values or finding the average for each channel.  Their example programs go to a data grid, but you should be able to remove the data grid and use text boxes with no problem.  Try that and then report back if necessary.
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
Message 113 of 115
(1,489 Views)

Hi Micheal, i i was able to get my data from only one channel following the example that was shipped with the Measurement Studio but the problem is that i was only able to get it to either the Graph or the Datagrid and whenever i trie to convert it to Double so as to make it read  on a Label or Textbox, it tell me that " a 2 dimensional array double cannot be coverted to a 1 dimensional array double". And all the Example supplie are in 2 Dimensional array format. Can i  use the NI.statistics.mean or NI.statistis.Histogram properties to solve this riddle?  and how? or how else do i go about this?

Thanks for your assistance

Cheers

0 Kudos
Message 114 of 115
(1,464 Views)
The NI function will return a two dimensional array -> DataArray(channelNum, readingNum).

This is how I get averages out of that array:

Loop through by channel (y = 0 to numchannels - 1)
Loop through by samples (x = 0 to to numreadings -1)
sum(y) += dataarray(y, x)
inc x
end loop
average(y) = sum(y) / numreadings
x = 0
inc y
end loop

The NI functions probably do a better job.  There are some filters they have that I will be using soon, but I am doing this way for now.  Good luck!
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 115 of 115
(1,461 Views)