05-12-2015 10:33 AM
Hi Folks.
I the VI attached I am using write to spreadsheet to write to a file. However 2 rows are created every time I hit the generate button. Why is this? Is there a setting I am missing and why does it default to two? Anyone know how to rectify this?
Thanks,
Mark.
05-12-2015 10:47 AM - edited 05-12-2015 01:00 PM
As a first step you should change the mechanical action of your generate button to "latch when released" action (currently latch until released).
Try to find a way that the program does not use 100% CPU while it is not doing anything. Desing the code as a state machine instead of a "sequence worm". Take some LabVIEW courses and tutorials. What's the point of all these delays in the sequence?
05-12-2015 11:04 AM
Thanks. The latch action sorted it. I will change it to event driven. Just getting things working for the moment. Thanks for your advice.
Mark.
05-12-2015 12:42 PM
"Just getting things working" is how you end up with unmaintainable code. First you add a little functionality here...add a little functionality there....and pretty soon, you have spaghetti code that is 3 or 4 screens wide. You should always think about your base design architecture no matter how small the program (speaking from experience )
05-12-2015 01:02 PM - edited 05-12-2015 01:02 PM
Just some more general code comments.
I am not sure why you are converting to byte array and back and use two FOR loops in sequence. You should combine the loops and operate on the strings directly. Here are some alternatives. Same result!
There are many other ways to do this, of course.
05-13-2015 03:25 AM
Thanks a lot guys.