LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read data of sartorius scales with RS232 interface

Dear users,

 

I have to use a Sartorius scales with a RS232 interface.

 

In the attachment you see the program with which I try to read the data of this device – so far not successfully.

Therefore I have several questions:

 

  1. Could somebody tell me if the structure of my program is correct? I think so, because I saw that other people created similar code. But I am not totally sure about this.

  2. To read data of the scales, I have to send a print control to the device. In the manual of the device is written that the print command is as in the attached picture. They mention that ESC = Escape, CR = Carriage return, LF = Line feed.

    So, how do I write this command correctly? Do I have to write in a string ESCPCRLF, or ESC P CR LR or ESC,P,CR,LF, or…? I am really totally lost here because I have never worked with such an interface so far.

  3. I do not have a RS232 interface on my computer, so I use an USB to serial adapter. Do I have to adapt the baud rate etc. of my adapter in the windows device manager to the values of my scales?

  4. When I run my program, the number of bytes at serial port is always 0. Could this be that I use next to my USB to serial adapter another adaptor to connect the 9-pin USB connector to the 25-pin connection of my scales - perhaps a connection is wrong?

I really would appreciate your help much!!

Download All
0 Kudos
Message 1 of 26
(9,845 Views)

Hi!

 

1) You code is ok for a single query, but I would remove the Flat Sequence Structures and all the delays ("Wait ms").

2) In your string replace "ESC" with the escape special character \1B (HEX code of the ESC character)

3) No, you are configuring the serial port directly with VISA.

4) In your code you ask the number of bytes at serial post before sending the command

 

Regards,

Marco

0 Kudos
Message 2 of 26
(9,832 Views)

Hi Marco,

 

Thank you very much for your quick and detailed reply.

  1. I use delays because it is recommended here: http://digital.ni.com/public.nsf/allkb/874B379E24C0A0D686256FCF007A6EA0

    But also without delays, I still cannot get data from my scales.

  2. Thank you, my write command is now \1Bp\r\n, I hope this is correct. But, as said, I still do not get data…

  3. OK

  4. OK, I corrected my code (see new attachment). But I still get back a 0 for the number of bytes at serial port…

Perhaps I should mention the following:

If I use in my code byte count = 0, I get the warning code: 1073676294. If I increase byte count to 1 or higher, I get the error code: -1073807339 (which led me to the link above and let me use some time delays).

 

Do you or somebody else have an idea how I could get data of my scales?

 

Download All
0 Kudos
Message 3 of 26
(9,820 Views)
Have you tried any of the existing drivers for scales from that vendor? There should be one that is similar.

http://search.ni.com/nisearch/app/main/p/bot/no/ap/tech/lang/en/pg/1/sn/n2:RS.sartorius,ssnav:idr/

Double check your cabling with a meter.

With the device using termination characters, using delays and the Bytes at Serial Port is incorrect.
0 Kudos
Message 4 of 26
(9,802 Views)

Thank you for your reply.

 

Searching for drivers was one of the first steps I did. But unfortunately my device is so old (about 25 years) that there is no driver. I also tried to work with the programs of the LabVIEW LLB which are available from your link, but there I also get the 1073807339 error code.

 

Checking the cabling is for sure a good idea. So far it seems to be fine.

 

Thank you for your hint that the use of delays and the Bytes at Serial Port is incorrect.

But why is Bytes at Port then mentioned in this NI-document:

http://digital.ni.com/public.nsf/allkb/874B379E24C0A0D686256FCF007A6EA0

There they also mention the delay which should be used for older instruments. Since my device is about 25 years old, I thought that the use of wait is a good idea.

 

But perhaps you are right. So, could you please correct my program then? As I mentioned, I have never worked so far with the RS232 interface, so I really would be glad if somebody corrects my code.

0 Kudos
Message 5 of 26
(9,789 Views)

@partial wrote:

Thank you for your reply.

 

Searching for drivers was one of the first steps I did. But unfortunately my device is so old (about 25 years) that there is no driver. I also tried to work with the programs of the LabVIEW LLB which are available from your link, but there I also get the 1073807339 error code.

 

Checking the cabling is for sure a good idea. So far it seems to be fine.

 

Thank you for your hint that the use of delays and the Bytes at Serial Port is incorrect.

But why is Bytes at Port then mentioned in this NI-document:

http://digital.ni.com/public.nsf/allkb/874B379E24C0A0D686256FCF007A6EA0

There they also mention the delay which should be used for older instruments. Since my device is about 25 years old, I thought that the use of wait is a good idea.

 

But perhaps you are right. So, could you please correct my program then? As I mentioned, I have never worked so far with the RS232 interface, so I really would be glad if somebody corrects my code.


Unfortunately, what NI doesn't tell you is that "Bytes at Serial Port" is a last resort, to be used only if you have no other way to figure out if a device has completed sending data.  Since you have a marker - the line feed termination character - I would configure the VISA serial port to use it, and then discard the white space (the CR) at the end.  That way you read exactly the data and don't have to insert a wait to make sure everything was read.

 

IMHO - If you have to insert a "wait" in between commands, you probably don't fully understand how to communicate with the equipment.  Of course, I have worked with power supplies that are so "dumb" that the programming guide says that you have to wait x milliseconds for a command to process!  😉

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 6 of 26
(9,781 Views)
Test it with a program such as putty or any other terminal emulation program.
0 Kudos
Message 7 of 26
(9,774 Views)

Billko, thank you for your explanations. I changed my code (see attachment – I hope it is correct now), but I still do not get any data of my device.

Do you have any other ideas? I hope so, because I am stumped.

Download All
0 Kudos
Message 8 of 26
(9,762 Views)

Dennis_Knutson, thanks for this idea! I tried to follow your advice and used putty for some hours – but I was never able to type anything into the command window (I gave up to find a solution for this). So I used the program “Termite” to retry to read data from my device. Well, at least I can write something into the command line of this program, but the result stays the same: I still do not get any data of my device.

 

So, any other ideas? I hope so!

0 Kudos
Message 9 of 26
(9,760 Views)
Just the normal serial troubleshooting. Confirm the baud rate, parity, etc. Check if you need a null modem or straight though cable. Confirm you are sending both carriage return and line feed. This should be a program setting - not something you type. Same for the escape. This is a keyboard action.
0 Kudos
Message 10 of 26
(9,753 Views)