Eudaemonic Posted May 25, 2006 Report Share Posted May 25, 2006 Hi I'm a first timer and my experience with LabVIEW is limited (although growing fast everyday) I built this little VI where I am reading HEX values (bytes) from one file. I format the data and pass it to a FOR loop where Hexadecimal String to Number puts every byte into a unsigned integer array using an Auto-Indexed Tunnel. I then repeat the process for a second file. This completes my VI When I run the VI for the 1st time (read from 2 files), it works perfectly fine. But when I run it for a 2nd time (read for the 3rd and 4th time), the integer array is filled with 0's (wired an indicator). Only way to get around this is to fully close the VI and then re-open it. Should i re-initialize the tunnel every time? If so, how? Could it be that my array is 'big' i.e. 7200 items? Hopefully I'm clear enough Thanks for your help Fred Quote Link to comment
Michael Aivaliotis Posted May 25, 2006 Report Share Posted May 25, 2006 I wish you could upload an image of your diagram. Quote Link to comment
crelf Posted May 25, 2006 Report Share Posted May 25, 2006 I wish you could upload an image of your diagram. ...or even attach a VI that you've already created so we could suggest modifications... Quote Link to comment
peteski Posted May 26, 2006 Report Share Posted May 26, 2006 Could it be that my array is 'big' i.e. 7200 items? Fred, It couldn't be the array size, 7200 items is not at all big! I've filled arrays to the point that I ran into RAM limitations, so lets say 300MB of free space, 8 bytes per array element, comes to about 37,000,000 array elements. Sure, the computer gets a bit testy in these cases, refuses to respond, etc, etc..., but never at a mere 7200! As Mike and Crelf said, post what you have and someone here ought to see the problem. -Pete Liiva Quote Link to comment
Eudaemonic Posted May 26, 2006 Author Report Share Posted May 26, 2006 Thanks for the help. My VI sends register and memory content to an IC using SPI. Here is a screenshot of the 2nd sequence of my VI. The sequence right after is the exact same but I load a different file. The 1st, 4th and 5th sequences send hardcoded data to the SPI programmer no arrays involved. That's it. Run the whole thing once, you're fine. Try to do it again, array is filled with zeroes. the file being loaded in the beginning is of the following structure 0xXX, 0xXX, 0xXX, .... where XX is a HEX representation of a byte. Thanks again Quote Link to comment
crelf Posted May 26, 2006 Report Share Posted May 26, 2006 0xXX, 0xXX, 0xXX, .... where XX is a HEX representation of a byte. Just to confirm - your file structure is: 0xXX<space><comma>0xXX<space><comma>0xXX<space><comma> ... where XX are your HEX characters? (it helps to attached an actual example file to clear up these misunderstandings). Quote Link to comment
Eudaemonic Posted May 26, 2006 Author Report Share Posted May 26, 2006 it's actually 0xXX<comma><space>0xXX<comma><space>0xXX<comma><space> ... Is there a way to upload my code along with sample files (25kb)? Quote Link to comment
Darren Posted May 26, 2006 Report Share Posted May 26, 2006 The problem is occurring because you are not initializing the shift register that is wired to the offset input of the Hexadecimal String to Number function in your For Loop. Whatever index value was the last value written to that shift register will be the first value given the next time the VI runs. So this will probably be a large offset value that is at the end of the file, thus resulting in no hexadecimal value found, thus resulting in a default value (zero) being output from the function. I think if you wire a zero constant to initialize the shift register the problem will be solved. -D Quote Link to comment
Eudaemonic Posted May 30, 2006 Author Report Share Posted May 30, 2006 The problem is occurring because you are not initializing the shift register that is wired to the offset input of the Hexadecimal String to Number function in your For Loop. Whatever index value was the last value written to that shift register will be the first value given the next time the VI runs. So this will probably be a large offset value that is at the end of the file, thus resulting in no hexadecimal value found, thus resulting in a default value (zero) being output from the function.I think if you wire a zero constant to initialize the shift register the problem will be solved. -D Thank you so much Darren! I knew it probably was something very simple. It now works exactly how I want it to. Thanks again Fred Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.