Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GetComStat() function does not detect errors.

I am implementing a full duplex RS-232 communication channel where I poll for input data by using the GetInQLen() function. Once I have data I first check for errors by calling the GetComStat() function. This function never seems to return an error code even when I send data with the wrong parity, baud rate, etc.
0 Kudos
Message 1 of 5
(3,739 Views)
Hello,

This worked fine for me when I tried it. Although you do not say, I assume you are using CVI. Here's a good way to test it out in CVI 7.0: CVI comes with a serial example in the samples\rs232 directory called "serial.cws". This is a good place to start for using serial functions. I performed the following test: hook up a null-modem cable between my 2 onboard COM ports, starting the example program on COM1 and configuring the port to 9600 8N1, XON/XOFF is Off, RTS/CTS is off. Then I opened Hyperterminal on COM2 setting 9600 8E1, No flow control. I typed a single character into hyperterminal and then switched back to the example and clicked on "Get COM Status" and got a parity error. I performed various other mismatches including baud rate and the C
OM Status function performed properly.

If you could run this test and let me know how it goes, that would be helpful. Alternately, this might illuminate the best way to use the COM Status function. Please let me know what version of CVI you are running when you reply.

Thanks,
Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(3,739 Views)
Hi Scott,

Thanks for the reply. I am using CVI 6.0 I am testing my application the same way you describe by connecting a null modem between my 2 COM ports. I also have an external analyzer (HP4957A). When I change the parity or baud rate on one channel I see it change on the analzyer (eg I need to setup the analyzer to the new settings to read the data) but my receiving COM port does not detect any errors with the GetCOMStat() function. If I go ahead and read the data using ComRd() and the parity is mismatched between the channels the data is fine. If I force a baud rate mismatch between channels then the data read is bogus. Another thing I should mention is that I am making a call to the function GetInQLen() before calling GetCOMStat() and ComRd().

Ji
m
0 Kudos
Message 3 of 5
(3,739 Views)
Jim,

Calling GetInQLen() before GetCOMStat() is causing your problem. If you make the call to GetCOMStat() before GetInQLen(), you should see the parity mismatch.

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(3,739 Views)
Hi Scott,

Thanks much. I now have my application detecting parity and framing errors.

Thanks,
Jim
0 Kudos
Message 5 of 5
(3,739 Views)