From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 116 occurs at Unfratten From String in my .VI under certain conditions

Solved!
Go to solution

Hi everyone

 

I am currently developing a VI program that performs the initial configuration of the device utilized for measurements. Some of the instruments employed for measurement purposes possess IP addresses. Within the enclosed VI file, I have implemented a string-based form for entering the IP address. Furthermore, to ensure the retrieval of these established settings in future sessions of the VI file, I have incorporated a function that generates a cfg file upon completion of the settings and reads a corresponding cdg file upon VI startup.

 

However, inexplicably, I consistently encounter error 116 whenever I attempt to input numbers in the XXX.XXX.XX.XX format. I have attempted various approaches, such as incorporating random characters and elongating the numbers, but the error solely arises when utilizing the XXX.XXX.XX.XX format.

Despite my efforts to investigate this issue, I have been unable to conceive of a viable solution. 

 

herefore, I kindly request your guidance on this matter.

 

hiro

0 Kudos
Message 1 of 9
(812 Views)
Solution
Accepted by topic author hiro1192

I think you have an issue in that you are reading and writing to text files.  By default, reading and writing text files will convert all of your Carriage Returns (CR) and your Line Feeds (LF) into a CRLF.  I think this is messing up your flattened string.  Specifically, XXX.XXX.XX.XX is 13 characters.  When this is prepended to the string length, you have a 0x0D, a Carriage Return.  That then gets converted to a CR LF (and extra byte is inserted) and this then shifts all of the end data by a byte and messes up all of those values.

 

The solution is to use Read Binary File and Write Binary File directly with your cluster.  I also corrected your cfg file, removing the extra line feed.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 2 of 9
(772 Views)

Thank you for your reply.
Your helpful advice solved the problem.
Thank you.

0 Kudos
Message 3 of 9
(750 Views)

It would be sufficient to disable "convert EOL".

 

altenbach_0-1684601947368.png

 

0 Kudos
Message 4 of 9
(735 Views)

Thank you for your reply.
This problem could have been solved this simple way.

May I inquire as to the purpose of including a "wait" command within the while loop?
As a novice, I lack the understanding of why the wait command is necessary in this while loop.

0 Kudos
Message 5 of 9
(708 Views)

Without wait, the loop will spin millions of times per second, one cpu core will be at 100% forever, draining your laptop battery or wasting electricity, while starving all other processes that also want a slice of the pie.

Seem like too much effort just to poll a button. How fast can you possibly push it?

 

And yes, an event structure as suggested is a better, but slightly more advanced choice, of course.

0 Kudos
Message 6 of 9
(694 Views)

I see, it is indeed important to wait for time in the wait loop.
In actual use of this program, it takes about a minute to run the program and press a button, so it's better to have a wait.

Sure, that's why my computer was overheating when I ran this program in a test.

Thank you.

0 Kudos
Message 7 of 9
(678 Views)
Solution
Accepted by topic author hiro1192

For the same reason, I used an Event Structure instead of the loop.  The Event Structure sleeps until a registered event happens.  Most UIs should be using the Event Structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(639 Views)

Thank you.
Your helpful advice has made me learn a lot.

0 Kudos
Message 9 of 9
(609 Views)