LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 communication problem

Hi all,

I try to read out the data of a METEX M-3850D multimeter in a LabWindows CVI
program (5.0.1).
These are the communication parameters:
1200 baud, 7-bit ASCII, no parity, 1 stop bit.
I use serial port 2.
After sending the characters 'D' and 'enter', the multimeter should respond
with a 14-character frame.

This is the code I use:

int numbytes;
char buf[512];
OpenComConfig (2, "", 1200, 0, 7, 1, 512, 512);
SetCTSMode (2, LWRS_HWHANDSHAKE_OFF);
FlushInQ (2);
FlushOutQ (2);
numbytes = ComWrtByte (2, 68);
numbytes = ComWrtByte (2, 13);
numbytes = ComRd (2, buf, 14);
CloseCom (2);

This is the problem: after the instruction OpenComConfig, the RD line is
pulled high (+15V) by the computer, resulting in a logical 0 and thus
blocking the port. Wi
th a scope, I can clearly see that the multimeter is
responding its 14 characters, but as this results only in a 0.5 volt signal
superimposed on the +10 V, the computer is of course unable to read this
data.
Only after about 5 seconds after calling the ComRd instruction, the RD line
is released.
There are no problems with the TD line.
When the multimeter is unplugged, the same thing happens (except the
response of the multimeter of course), so I blame my program, my serial port
or LabWindows.
Changing the SetCTSMode does not help.
What could be the problem?

Kind regards,
Geert
0 Kudos
Message 1 of 6
(4,229 Views)
Try the following:

int numbytes;
char buf[512];
OpenComConfig (2, "COM2", 1200, 0, 7, 1, 512, 512);
FlushInQ (2);
FlushOutQ (2);
sprintf(buf,"D\r");
numbytes = ComWrt (2, Buf, 2);
numbytes = ComRd (2, buf, 14);
CloseCom (2);

Best regards.
Farid.
0 Kudos
Message 2 of 6
(4,229 Views)
"Farid Bengrid" wrote in message
news:5065000000050000004E410000-999158726000@exchange.ni.com...
> Try the following:
>
> int numbytes;
> char buf[512];
> OpenComConfig (2, "COM2", 1200, 0, 7, 1, 512, 512);
> FlushInQ (2);
> FlushOutQ (2);
> sprintf(buf,"D\r");
> numbytes = ComWrt (2, Buf, 2);
> numbytes = ComRd (2, buf, 14);
> CloseCom (2);
>
> Best regards.
> Farid.

Thank you for your input, but the results are just the same ...

Best regards,
Geert
0 Kudos
Message 3 of 6
(4,229 Views)
Hi geert,

Did you try with hyperterminal ?

Best regards,
Farid.
0 Kudos
Message 4 of 6
(4,229 Views)
> When the multimeter is unplugged, the same thing happens (except the
> response of the multimeter of course), so I blame my program, my serial
port
> or LabWindows.

This is not correct. It is indeed the multimeter that messes up its own data
transmit line (which is the PC data receive line). So I will start reverse
engineering which command is still missing to put the multimeter in its
appropriate mode.

Sorry for bothering you. Thanks for your inputs and your time, Farid!

Geert
0 Kudos
Message 5 of 6
(4,229 Views)
Geert

Try this small example program to see if you can communicate with your multimeter correctly. If you have the same problem with this program, let me know.

Brian
0 Kudos
Message 6 of 6
(4,229 Views)