Showing results for 
Search instead for 
Did you mean: 

input txt file to LabVIEW

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?





0 Kudos
Message 1 of 9

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?



0 Kudos
Message 2 of 9
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

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.



0 Kudos
Message 4 of 9

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

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



0 Kudos
Message 6 of 9

it is fixed at 100 ms

0 Kudos
Message 7 of 9
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.



0 Kudos
Message 8 of 9

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


3 Hour Introduction

6 Hour Introduction

LabVEW Basics

Self Paced training for students

Self Paced training beginner to advanced, SSP Required

LabVIEW Wiki on Training

0 Kudos
Message 9 of 9