08-10-2011 11:22 AM
I thought it would be important to include the vi, so if there are any glaring problems they can be easily identified. To get everyone up to speed: I have resolved all issues except one (and I haven't actually hooked up the RS232 yet, so there may be more) - the issue is incrementing the row following each data read. What happens is the data is only saved in one row (each read updates the row fields). I'm looking for a way to read data every 5 seconds, and store in subsequent spreadsheet rows.
08-10-2011 12:15 PM
08-10-2011 01:53 PM
Here's the whole vi. I'm guessing that I'm not properly incrementing the row data.
BTW, thanks for the help.
08-10-2011 02:15 PM
That's just a repeat of what you've already posted. Did you do any of the edits I recommended?
08-10-2011 02:27 PM
Brilliant. I don't have a cleanup tool - I'm using version 8.5 - maybe it comes standard on newer versions? Anyway, the next steps are to hook the device up to a serial port, and start collecting data. I am awaiting a RS232 adapter for the scale we are using (it is expected to arrive in the next couple days). In the meantime, here's the vi...
BTW, thanks for all the help - much appreciated.
08-10-2011 03:42 PM
I'm using a serial-to-usb adapter (with a laptop) - com4. I wasn't reading any data in the vi, so I placed a numeric indicator at the "Bytes at Port" output (from the Instr function). I get zero bytes reported. I'm guessing I have something hooked up incorrectly - not sure what. Any ideas?
08-10-2011 03:58 PM
JUST the Serial Port Setup outside the VI, not the read and write! It'll never update like you have it.
If you can post the actual VI, not just a picture, maybe me or someone can edit it. Better yet, check out the Serial Port examples that ship with LabVIEW, and read the manual. You are missing some very basic knowledge which is making your job difficult.
08-10-2011 04:06 PM
Thanks for the comments - you are correct, about me missing some basic knowledge. I come from a command line background, and I'm having some growing pains - time will cure that. I've attached the vi, as I don't really understand the proper use of the flat sequence.
Geddy.
08-11-2011 10:24 AM
More like this below. Note that the flat sequences are just to force dataflow on the Delay function.
Doing the arbitrary 50mS wait after Writing to the serial port is, for now, just a quick method to see if you get data. The best way to read the data is to poll Bytes At Port until you know all the expected bytes have been received. Anyway, reconstruct you VI like this one and give it a try.
08-11-2011 10:37 AM
Do not put a shift register on the error wire. If you ever get a stray error such as an occasional timeout, and that can certainly happen periodically with serial communications, it would prevent all of your VISA functions from operating on the next iteration of the while loop. You'd be forced to stop the VI and restart in order to clear the error out of the register and start communicating again.