LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find file on unknown drive letter

I am writing a test in TestStand and need a LV VI that will test USB communication with multiple memory sticks.  There are three different sticks with unique filenames connected to the system.  I want to read from the file to ensure proper USB communication with the stick.  The sticks enumerate with different drive letters on different test systems so I cannot hard code the drive letter portion of the path. 

 

I attached a screen shot of what I have so far.

 

In this example the drive is enumerated at F.  The filename is 3PortRackTest1.txt.  When the DriveLetter is correct and the file is found: the FileFound = 0.  When the drive letter is wrong the file will not be found and FileFound = 7.

 

I need to scroll thru all the letters for DriveLetter until the file is found (FileFound = 0) then I know how the memory stick is enumerated.  Then read the contents of the file and know USB communication is working.  How can I change the value of DriveLetter?  It is a constant.  Does LV have variables?  I am thinking, take what I have and put it in a For Loop 26 times and somehow relate the numbers 1 thru 26 to the letters (maybe an array?).  But how do I get out of the For Loop when I find the right DriveLetter?

 

Thanks,

A newbie,

Steve

 

0 Kudos
Message 1 of 4
(2,916 Views)

I'm thinking you're probably better off using something like devcon to find the actual USB drive.

 

Alternatively, you can use List Folder with an empty filepath input in order to retrieve all of the attached logical drive letters on your system. You can then send those through an autoindexing for loop and build path and search for your file and key off the error.

0 Kudos
Message 2 of 4
(2,911 Views)

Would you consider programming in c (or Matlab, or Basic) if you knew nothing about the Language and hadn't looked at tutorial material?  What you want to do is trivial once you look at the tutorials.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

 

Bob Schor

Message 3 of 4
(2,897 Views)

I have a test with DevCon working.  I can see the new USB devices come online.  But I wanted to try this. 

0 Kudos
Message 4 of 4
(2,842 Views)