LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem running two parallel while loops

Solved!
Go to solution

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

 

0 Kudos
Message 51 of 95
(350 Views)

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

 

0 Kudos
Message 52 of 95
(336 Views)

@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]

Backslash codes

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 53 of 95
(318 Views)

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

 

0 Kudos
Message 54 of 95
(295 Views)

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.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 55 of 95
(286 Views)

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

 

0 Kudos
Message 56 of 95
(266 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 57 of 95
(257 Views)
Thanks for the help Bill. Can you help me with parsing if I setup continuous data output in the scale? I really need the data collection to be automated because I will have two scales sending data at different times based on the timeout value.

Regards,
Avi0111
0 Kudos
Message 58 of 95
(234 Views)

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.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 59 of 95
(228 Views)

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

0 Kudos
Message 60 of 95
(216 Views)