03-26-2013 12:47 PM
Hi everyone,
I acquired a null modem cable as per your advise and managed to have the scale send weigh data to the front panel in g using Billko's modified program. I am attaching the screen shot below. the setting i used are as follows;
Manual print
DTR hardware handshake
I have a question regarding the output trimmed string, what is "N". What does it stand for, is it a stray character which I can neglect?
Next I will be trying to send the data to an excel spreadsheet and experimenting with automatic printing setting on the scale.
Thanks,
avi0111
03-26-2013 02:07 PM
Hello Everyone,
Moving forward, I have managed to get the data format specifier right for Scan for String command and have the data being displayed as a waveform as well as being saved in a spreadsheet. At this point i have a few questions,
1) How do I make sure that the program sends a print command every 30 seconds (i would like a control where I can change the interval)?
2) Can I override the default timeout of the Read function so that the only times the data is accepted from the weigh scales is when I send it a Print command via VISA write?
3) The Write to excel command opens multiple excel sheets (each for a different reading) How do I append all data into a single file?
Regards,
avi0111
03-26-2013 03:59 PM - edited 03-26-2013 04:00 PM
@avi0111 wrote:
Hello Everyone,
Moving forward, I have managed to get the data format specifier right for Scan for String command and have the data being displayed as a waveform as well as being saved in a spreadsheet. At this point i have a few questions,
1) How do I make sure that the program sends a print command every 30 seconds (i would like a control where I can change the interval)?
2) Can I override the default timeout of the Read function so that the only times the data is accepted from the weigh scales is when I send it a Print command via VISA write?
3) The Write to excel command opens multiple excel sheets (each for a different reading) How do I append all data into a single file?
Regards,
avi0111
in reply to:
1) THAT is our next step. The manual was so poorly written that I could not understand what to send! I think the esc key is optional, but you might have to send the ascii wait plus your print command. At this point, you could probably enable the code in teh beginning and fool around with sending stuff instead of pressing the print button.
I THINK it should look like:
!P\r\n
Note that the backslash codes are for carriage return and line feed. This text should be entered into a string constant or control with display set to "display \ codes." (Right-click on the control/constant and check '\' codes display.)
[edit]
03-27-2013 11:54 AM
Hi Bill,
Timeout error for !P\r\n with codes display turned ON. Do I have to change settings on the scale from manual printout to something that accepts software commands? The documentation of the scale is not very clear on that.
Thanks for your help and here's the code.
avi0111
03-27-2013 04:20 PM
There's a few things you could clean up, but it should work the way you have it! I think you have to add the [esc] character to the front of the string. It says "optional" but maybe it's not. 😉
03-28-2013 01:27 PM
Hi Billko,
I tried your modified program for a range of possibilities (Esc!P, EscP, !P,P etc and for different flow control settings (mainli XON and DTR together, because the manual says XON/XOFF is required for software handshake). Just doesn't seem to work.
Regards,
avi0111
03-28-2013 04:14 PM
I'm so sorry this isn't working for you. I knew the hard part would be writing the command. 😞 Have you tried eliminating either the linefeed or the carriage return? Also, the "manual" implies that there is a user's manual, and that the one you have is like a programmer's guide. See if you can find that user's manual. Maybe it can shed some light on how to set the balance up for sending commands.
I'm sorry - I have nothing more to offer at the moment.
03-29-2013 10:30 AM
03-29-2013 10:57 AM
I'm so sorry I couldn't understand the command well enough to help you out, but if you simply eliminate the part where we try to send the command, it should be a good enough framework for you to start with. It should be able to read what is coming back, although if you start the LabVIEW VI first, you would probably have to throw out the first read or two since in all likelihood you will be reading a data "already in progress." Other than that, you MAY run into a buffer overflow problem if your balance is writing faster than you can read, but that probably something that you don't have to worry about.
In short, the basic setup you have should do the required reading. You'll just have to flesh it out a bit to make it do anything useful. 😉
03-29-2013 01:51 PM - edited 03-29-2013 02:02 PM
Hi everyone,
So I had trouble sending the print command to the scale from the VI. So, I switched to auto-print option on the scale, meaning it continuously sends data and am facing these problems:
1) The first reading gives a timeout error as previously advised by Billko (incomplete strings at the beginning to parse correctly). But, this is not a major problem as I can wait for a few seconds and then start my data collection as the timeout error rectifies itself once it starts receiving complete strings.
2) This I am not able to discern whether it is an issue with the data output from device or a problem with parsing the string recieved.
Reason: If you look at my VI, the output of the trimmed string is as expected "N xx.xx g". And in the next step, the format specifier is used to exclude the N and return only the required value to the waveform and further onto the spreadsheet. But, with auto-print switched ON, irrespective of the load on the scale the trimmed string is "N 00.00 g".
Can someone help me out and probably suggest whether it is a programming/parsing issue or something else? I am attaching the VI to this post and all the documentation I have for the device.
Regards,
avi0111