LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

input txt file to LabVIEW

Solved!
Go to solution

I have a PCI controller card connecting to some servo drives, DAQNavi assistant running on LabVIEW 2011.

 

This is exactly what i'm trying to do:

 

I have a txt file containing some numbers. I want LabVIEW to open this txt file, read the numbers one by one and input them to PCI card at sample times. for example for sample time of 100 ms, it have to read 10 numbers and give them to PCI card during 1 second.

 

Any ideas on this?

 

Thanks

 

 

0 Kudos
Message 1 of 9
(912 Views)

This should be straightforward. What parts are giving you trouble? Reading the file? Converting the data to numbers? Writing it to the DAQ? The timing?

 

Lynn

0 Kudos
Message 2 of 9
(906 Views)
Actually i'm a little bit new to LabVIEW. i appreciate if you could explain me in details thanks
0 Kudos
Message 3 of 9
(904 Views)

You will learn more if you try to do it yourself and ask specific questions as you encounter difficulties.

 

Start by writing a VI which opens the text file and converts the text to an array of numbers. When you have that working (which can be done in the time it takes me to type this message), then you can move to the next step.

 

Lynn

0 Kudos
Message 4 of 9
(894 Views)

I'm done with this part. I just dont know how to make LabView to put the elements of the array to output at time samples respectively

0 Kudos
Message 5 of 9
(880 Views)

Is the sample time interval fixed or does it vary? If it varies, what controls the change?

 

Lynn

0 Kudos
Message 6 of 9
(870 Views)

it is fixed at 100 ms

0 Kudos
Message 7 of 9
(863 Views)
Solution
Accepted by topic author edi007

Easy. Put the write to the servo controller inside a for loop. Include a 100 ms Wait (ms) function. Wire the array from the outside of the loop to the data input of the write VI inside. The tunnel will automatically autoindex. That means that the data will be written one point at a time, every 100 ms, until every element in the array has been written.

 

You may want to add one more write after the loop to set the servo back to a default value before stopping the program.

 

Lynn

0 Kudos
Message 8 of 9
(845 Views)

If you are looking for some free LabVIEW training try some of these.

 

3 Hour Introduction http://www.ni.com/white-paper/5243/en/

6 Hour Introduction http://www.ni.com/white-paper/5241/en/

LabVEW Basics http://www.ni.com/gettingstarted/labviewbasics/

Self Paced training for students http://www.ni.com/academic/students/learn/

Self Paced training beginner to advanced, SSP Required http://sine.ni.com/myni/self-paced-training/app/main.xhtml

LabVIEW Wiki on Training http://labviewwiki.org/LabVIEW_tutorial#External_Links

0 Kudos
Message 9 of 9
(789 Views)