06-27-2014 07:27 AM
Hi everyone. I'm haveing trouble on running my VI, which performs a digital output with arduino and measurement reading with agilent 34410a. I'd like to know why this happens. It simply shuts down suddenly and I cannot complete my acquisitions.
Thanks!
06-27-2014 07:42 AM
How long does your application run before it crashes? Do you get any errors?
At the top of my head, I'm guessing that this is a Windows shutting down your USB hubs on you as a "power saving feature". You can go into the device manager and turn off that feature.
06-27-2014 09:45 AM
That is some of the strangest code I have ever seen.
After a few ctrl+Us with a few tweaks to the settings I could begin to read the code:
You really do have a nasty race condition with "Amp Instrumentação" where you change the strings (By the way- that is the most Rube Goldberg method of implementing "Rotate array" I've ever seen) and then read the value. Now you never actually change the values- so the user can only guess what value coresponds to what string- Thats OK Because you have a whole BOATLOAD of code to unwind the value with two case structures and some of the oddest bit shifting I've seen:
Trace that wire back though two cases and the comparison can never be "True" Notice how showing the radix on the constant and setting it to hex makes the code a lot more readable! AND suggests a logical shift of 14 would replace that whole snip! since really did we need all those "to boolean arrays" to add some integers together?
I have to admit this is the most obfuscated way to get 4 T or 4 F that I've come across:
The constant is 15 or 0 in every case why not just change it to a bool and branch the darned wire that enables your user controlls? (Interesting way to avoid setting a disabled and greyed property- the user must love that at times controlls do not work)
As to why the program crashes-- I have no idea! debugging that is going to be a nightmare until you unwind some of the obvious problems. but, fundamentally there is nothing actually "Wrong" here that should cause a crash (like unlimited file sizes or run-away memory needs)