LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW: An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? Or @.

Hi

 

The error occurred at the Set Position File.  I have no idea what that is.

Please have a look at the attachment, but the VI won't work without some external devices.

Thanks a lot for the help.

0 Kudos
Message 1 of 10
(15,514 Views)

Put a probe on the error cluster coming out of your file open.  My guess is that you have an invalid path, like the error says.

0 Kudos
Message 2 of 10
(15,512 Views)

Thanks. The file path is fine. The file can actually be written. If I move the file open into the while loop, no error occur. But in that case, the file would be written repeatedly and that's not what I want.

0 Kudos
Message 3 of 10
(15,509 Views)

Ah, I see.

 

You're closing your file and invalidating your refnum when you exit the S1 case.  Are you intending to do this?

 

If you intend to stay in the while loop and do another set File Pos, you'll either have to reopen the file or avoid closing it until after the while loop finishes.

0 Kudos
Message 4 of 10
(15,505 Views)

Taki:

 

I dont quite understand what refnum means. I think the while loop would keep running. The file would be open before the while loop starts, then the data would be written into the file. I wonder if this should be right: when the writing is done, the file should be closed. It won't be open until new data is coming in. 

 

Thanks!

0 Kudos
Message 5 of 10
(15,493 Views)

If you only want to open the file for each read operation, you need to place the open part inside the loop. If you open it outside the loop, you should only close it outside the loop.

 

It is typically much more efficient to keep the file open for the duration of the program. Why do you want to close it?

0 Kudos
Message 6 of 10
(15,482 Views)

Thanks for your answer!

 

I will try what you suggest.

If I don't close the file, the programm will keep writing the same data into the file. I hope the the writing would be executed once when there is a change of data, then no writing would be runned until next data comes in. The problem is I put the new coming data into a shift register for displaying. So the program will keep writing data into the file duet to shift register.

0 Kudos
Message 7 of 10
(15,469 Views)

Then the problem is with the rest of your code, not with the file IO. Right?

 

Don't write the data accumulated in the shift register.

Don't write unless there is new data (case structure can help here).

etc.

 

Can youi show us the code with the shift register?

0 Kudos
Message 8 of 10
(15,466 Views)

Thank you! You are right.

I think I have kind of solved the problem.

The wtriting will not be triggered until new data comes in (not from the shift register).

Now the problem is that I have to make sure the data is written into the file after it is accumulated in the shift register, cause the first written data is 0.

0 Kudos
Message 9 of 10
(15,459 Views)

Sorry I can't attach the file now and I have no idea why.

0 Kudos
Message 10 of 10
(15,457 Views)