LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High Precision Balance/Scale via USB Serial RS232 timeout error

Does the scale require that the software send it some command before it starts returning data? If so it will never send anything and that will certainly generate a timeout.

 

If the scale sends data continuously with minimal delay between packets, you will eventually get a buffer overflow. The Wait Until Next ms Multiple (set to 100 ms) will force the loop to wait at least 100 ms between iterations while a 22 byte packet takes about 21 ms to transmit with the settings in your VI. So the buffer accumulates ~ 4 packets for each one it processes.  If I did the math correctly, the buffer wold be full in about 5 seconds.

 

Remove the Wait. VISA Read will wait until it gets the specified character count, a termination character, or timeout, whichever occurs first. Then the loop will process the data as fast as it comes in.

 

Do you get any data or does it timeout on the first attempt? What is the Loop Counter value when the error occurs?

 

Lynn

0 Kudos
Message 11 of 22
(1,761 Views)
Why do you still refuse to provide the vendor of the instrument? Why won't you provide the manual? Have you even tried a port monitoring software to see what the vendor code does? Your unwillingness to answer some of these questions makes it hard to help you.
0 Kudos
Message 12 of 22
(1,754 Views)

The balance sends data continously. There is an option where I have to send a command then it returns me the measured value, but I am not using this option. And unfortunately I am not getting any data, I got the timeout an the first attempt.

 

I am using a balance AWS PN-6100A and an Acculab VA-30kg. Then vendor software I am using is for the AWS. I am using a USB-Serial converter model FT232R USB URAT.

 

As I am new in this field I am not really familiar with COM communication, so I have connected to the COM port via Hyperterminal and other softwares, but I couldn't write the commands to request the value measured or, for example, to zero or tare the balance. Regarding the monitoring softwares suggested here, I downloaded and installed them, however, when I am trying to connect to the COM port it says that the has been used already and I can't connect to monitor that port, and the same happens if I try to connect first with the monitor software and then use the vendor software.

 

I also created this much simpler code to test in LabView, but still I got the same error.

Download All
0 Kudos
Message 13 of 22
(1,720 Views)

On page 10 of the manual for the scale it does not mention any continuous transmission mode. If you had linked the manual and told us the type of balance in your orignal post, you probably would have had this working ten days ago.  It took me about two minutes to use the scale information in your most recent post to find the manual and determine the protocol.

 

It shows the data being sent terminated with a carriage return. It also specifies Xon/Xoff flow control.

 

Try setting your VI to the parameters indicated and send a Request weight data command before you try to read anything.  The manual example does not show a termination character being set to the scale.

 

Lynn

0 Kudos
Message 14 of 22
(1,713 Views)

I am sorry, I anwsered incorrectly, the Acculab has this continously data transmission, the other I don't know. Attached is the Acculab manual.

 

But I will do what you suggested with the AWS and see what I get.

 

By the way, I have set the settings (baud rate, parity etc...) and double checked and they are correct.

0 Kudos
Message 15 of 22
(1,702 Views)

Did you set the scale to the settings in your VI? The VI is certainly not set to the factory default settings for the scale. It is not clear from a quick glance at the Acculab manual that you can even turn off handshaking. While handshaking is not hard to manage, the simple example you started from does not include it.

 

You should always close the VISA session after the loop exits. Otherwise the port might be reserved by the OS and not available.

 

Lynn

0 Kudos
Message 16 of 22
(1,690 Views)

Yes, my scale is set to the VI settings.

 

Could you explain how I could deal with the handshake issue? I am new at LabView, so I'm still learning all of this.

 

Thank you.

0 Kudos
Message 17 of 22
(1,658 Views)

I finally could make it work.

The software I was using to monitor the serial port wasn't working for some reason in my Windows 7, so I installed in a Windows XP and it worked.

 

I finally found what the scale is doing and put it into my LabView code and it worked.

 

I did that for the AWS scale, I am still working on the Acculab though.

 

Thank you guys for helping me.

0 Kudos
Message 18 of 22
(1,620 Views)

Hello! I reealize it has been a very long time since this post, but maybe you'll still respond. I'm currently working with some made to order machine for measuring acoustic parameters (although I thnik this is not relevant). And it uses labview, however, the machine was built and the code written over 5 years ago by someone else, who has since lost the source code. All I have is an executable (or so I believe, it's a .vi file but it only brings up the UI to run the machine).

 

After installing all the necessary software, trying to run it on Xp and Win7 both, changing the USB Serial adapter, I keep getting the same timeout error you did.

Would you mind elaborating a but more on what you did that finally got it working?Maybe it'll help me!

 

P.D. The funny thing is the I have got it to work once or twice before, usually when I connect everything after just having turned on the computer, but whenever I try it again afterwards, I get the timeout error.

 

Thanks in advance,

Hopeful Faust

0 Kudos
Message 19 of 22
(1,520 Views)

Hello!

 

It's been a long time indeed man haha but I'll try to remember what I did.

 

I actually changed the scale I was using because, after some analysis, I found out that the scale serial port wasn't working.

For the new scale I had to send a command in order to get an answer from it, so using the scale manual I found the correct command to send and set LabView to do it. Another thing I did to eliminate the timeout error was to set the correct length of bytes read. I was getting this timeout error because the code was trying to read a string longer than it actually was.

 

After doing that my code started to work again.

 

About the source code you commented, all I had to do is to change the block diagram, I'm not a LabView expert (I'm actually a very basic user) but I believe that is the source code.

 

I hope it can somehow help you.

 

Cheers!

0 Kudos
Message 20 of 22
(1,497 Views)