LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

some problem in RS-232

hello~ all

i'm trying to comunicate with a balance of mettler.
i configured the baud rate, data bit, stop bit, etc. except
flow control.

then the type of received data is correct, but the starting point is
irregular.
for example, if it is correct (st +34.45345), the data i received is (st
+34.45345
st +35.35345
+35.35345 st
st +36.45455
..45455 st +37
st +37.45336
4336

what is the problem?

regard

y.s yi
0 Kudos
Message 1 of 4
(2,926 Views)
Hi,
Have you perused Help>>Search Examples...>>I/O Interfaces>> Serial
Communication ?

I learnt a lot about RS232 there.
Bye!

--
Francisco Javier Fernandez Luna
Ingeniero Tec. Industrial en Electronica.
Tel: 619 81 98 31
E-mail:franciscojavier.luna@uca.es
ó pacoluna@postmark.net
Would you like your answer in spanish? Please, let me know.
Si prefiere que conteste a sus preguntas en español, por favor, hagamelo
saber.

"Let's make things better" (PHILIPS)

ÀÌ¿ë»ó escribió en artículo
<7hs2u0$l4g$1@hiline.shinbiro.com>...
> hello~ all
>
> i'm trying to comunicate with a balance of mettler.
> i configured the baud rate, data bit, stop bit, etc. except
> flow control.
>
> then the type of received data is correct, but the starting point is
> irre
gular.
> for example, if it is correct (st +34.45345), the data i received is (st
> +34.45345
> st +35.35345
> +35.35345 st
> st +36.45455
> .45455 st +37
> st +37.45336
> 4336
>
> what is the problem?
>
> regard
>
> y.s yi
>
>
>
0 Kudos
Message 2 of 4
(2,926 Views)
I think the result seems to have some characters missing to get from RS232C
port.
The problems may come from that there was no receive buffer for the port.

I think you might have not specify buffer size in the "port init", otherwise
the actual
buffer size would set to 0: That means if LabVIEW executes other than "read
port" and
a new byte received at the port, the byte may be lost after next byte comes
in.

Please try to set buffer size perhaps 100 or 256 will help.


¿Õ½ûû <¿Õ½ûû > wrote in message <7hs2u0$l4g$1@hiline.shinbiro.com>...
>hello~ all
>
>i'm trying to comunicate with a balance of mettler.
>i configured the baud rate, data bit, stop bit, etc. except
>flow control.
>
>then the type of received data is correct, but the starting point is
>irregular.
>for exa
mple, if it is correct (st +34.45345), the data i received is (st
>+34.45345
> st +35.35345
>+35.35345 st
> st +36.45455
>.45455 st +37
> st +37.45336
>4336
>
>what is the problem?
>
>regard
>
>y.s yi
>
>
0 Kudos
Message 3 of 4
(2,924 Views)
"�̿��" wrote:

> hello~ all
>
> i'm trying to comunicate with a balance of mettler.
> i configured the baud rate, data bit, stop bit, etc. except
> flow control.
>
> then the type of received data is correct, but the starting point is
> irregular.
> for example, if it is correct (st +34.45345), the data i received is (st
> +34.45345
> st +35.35345
> +35.35345 st
> st +36.45455
> .45455 st +37
> st +37.45336
> 4336
>
> what is the problem?
>
> regard
>
> y.s yi

#################

Hi y.s. yi,
I also had problems like yours in the past, as I wasn't to familiar with the
RS-232.
First, you don't mention in your posting, if you use VISA, or the regular
(old) VIs.
If you use the old ones, like I do it should work, if:
- you first flush the serial input buffer before sending the data request to
the Mettler weighing Instrument, because there may be some bad data
(distortion) in the buffer.
- second, you should know and specify how many databytes you want to read
from the input buffer, or you determine how many bytes there are in the
input buffer and then read them all. (Bytes at serial port.vi and serial
port read.vi)
If you are good at programming and the Mettler sends allways the same
termination Character after replying, you may write a VI which determines
the amount of bytes in the input buffer, then read the input buffer and
store the contains in a string. If the termination character occurs in the
string, then use part of the string from the beginning to the termination
character. If the terminator does not occur, wait some milliseconds, and
repeat from determining the bytes in the buffer again and concatenate the
second portion of bytes to the first one. Then search for the terminator
again. Do this until you find the terminator in the complete concatenated
string, or break with an error because of timeout, whatever occurs first.
Dont forget to close the serial port, if you are finished using the serial
port.
Oh, btw. Because I myself use RS-485, I don't have to care about
handshaking. I can't say if this is importend in your case.

Good luck,
Rainer
0 Kudos
Message 4 of 4
(2,917 Views)