11-11-2008 10:18 AM
chirs73 wrote:I got a lot of flack for that b/c the people I work with are lazy and want everything done for them.
Can we quote you on that? ![]()
Presumably somewhere you're storing the last serial number that was used. In this case what you want to do is fairly simple. Have a text file with the list of serial numbers as a column. Use the Read From Spreadsheet File function to read the file as an array of strings. Search the array of strings using the Search 1D Array for the last serial number used (you may wish to ignore case sensitivity by converting all strings to lower or upper case). This gives you an index into the array. Then, you just need to increment the index in your loop (or whatever you're using) to run the test on the next serial number. This is really not difficult.
11-11-2008 01:26 PM
I have altered the code you showed to try and obtain the results I need. I can't get it to work properly. I have attached the code so you can see what I have done.
Thanks
Chirs
11-11-2008 01:43 PM
11-11-2008 01:49 PM
11-11-2008 02:08 PM
chirs73 wrote:I have altered the code you showed to try and obtain the results I need. I can't get it to work properly.
Are you referring to the little snippet I showed? 'Cause I don't see it anywhere in your code, so I don't know what you implemented.
11-11-2008 02:25 PM
11-11-2008 03:14 PM - edited 11-11-2008 03:15 PM
Ok to address the problem at hand: You are probably getting "junk" out of the read from spreadsheet VI. this is because Excel is a proprietary format and you must use Active X Excel functions to do this. If you would save your file as a .csv and change the delimeter to be (comma) or just make it a simple text file then it will work.
Second: Lets talk about code Architecture. Your code the way that you have it is very cumbersome and hard to read and is not upgradeable at all and will be very hard to manage to say the least. You should look at the examples of a Quequed state machine do a search here on the forums and you will find some examples. Also the event structure will be a big advantage to you.
Your outer most loop does nothing for you. It only runs once (since you have a false constant wired to the stop) and well guess what when you stop the second while loop you are stopping the program from running so get rid of the outer most loop.
you are also continuosly polling the test button to see if it has been pressed. this is where the event structure would benefit you.
your inner most while loop has two case structures in it that have the same case names, just combine the two case structures into one.
This should give you enough to think about for now.
11-19-2008 09:09 AM
I have made some changes to my code. The reason for the outermost loop is to have the test constantly running....especially when I create the executable. I don't need to catch any flack from the people who will be using this. I'm making my tests as idiot proof as possible. I'm still working on the reading the serial number out of excel.
Chirs
11-19-2008 09:29 AM
11-19-2008 09:35 AM
I knew you could figure it out. If you want it to quit like a normal windows program you can add an event called front panel close to the event structure and it will work. I will look more at your vi later when I get more time.