08-24-2012 07:28 AM
Dear all,
I've created a Vi that can select and convert hexadecimal numbers from a string array. These hexadecimal numbers contain acceleration data (units g).
My string array (from line 68+) places every 10 rows a 1 line of hexadecimal number with a length of 300. I've managed to convert this into 1D array DBL.
My current problem is, when I run my for loop my graphical representation of the acceleration data changes overtime!
Can anybody help me solve this problem?
Thanks in advance
08-24-2012 07:52 AM
It's likely because you have race conditions. LabVIEW is a data flow language. It will execute code when the data is available. By using the value property nodes, you have broken your data dependence. Use wires instead.
08-24-2012 02:23 PM
You have four code islands that all start in parallel.
When you run the program, the code segment on the right immediately reads the three value properties (Since the corresponding indicators have not been updated at this point, they are most likely stale or empty). Once this part is done, the graph will never update again and changing the ring later will not make a difference.
The three FOR loops also start in parallel with the same problem. the Array value property is read before the loop below had a change to update the indicator. The big loop starts while the "element" array is still being filled, leading to completely unpredictable results.
Overall, the code does not make a lot of sense. Lost of duplicate code and lots of dead code. I have the feeling it could be done with 20% of the code overall. In many places you could use autoindexing.
08-24-2012 03:01 PM
I found a little dead time and decided to have a little fun cleaning up. Notice that I removed the FOR loops on the left side. The biggest thing was that I used the Read Text File configured to read lines (it gives me an array of the lines in the file), got rid of the first 68 lines, and then passed that array into the FOR loop. Your code there was next to impossible to figure out, even with the comment. I have no clue where you came up with trying to update every 25ms. It shouldn't take your processing that long. Instead, just index out the lines inside of the loop.
There's still a bunch of cleaning up to do, but it's quitting time for me. I'll try to get on sometime this weekend of you have more questions.