05-20-2023 02:33 AM
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
Solved! Go to Solution.
05-20-2023 07:34 AM - edited 05-20-2023 08:17 AM
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.
05-20-2023 09:42 AM
Thank you for your reply.
Your helpful advice solved the problem.
Thank you.
05-20-2023 11:59 AM
05-20-2023 09:10 PM
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.
05-20-2023 10:00 PM - edited 05-21-2023 09:43 AM
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.
05-21-2023 01:42 AM
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.
05-21-2023 06:36 AM
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.
05-21-2023 01:25 PM
Thank you.
Your helpful advice has made me learn a lot.