Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication with niVisa (and GPIB) don't work beside a serial interface

Solved!
Go to solution

Hi

 

I have programmed an application in C++ (Visual C++ with MFC, running on XP). On one side, I control different measurement equipments (also from different vendors). All the communication is done with niVisa (Version 4.6). On the other side, I send remote commands to a generator over the serial interface. For this, I use CSerialPort, it's a MFC-Wrapper for the Windows API. So, niVisa isn't used for the serial connection.

 

This is working without any problems as long as I connect the measurement Equipment (it doesn't matter what kind of) over Ethernet.

 

When I now connect the Scope via GPIB (I use a NI PCI-GPIB card), the communication works without any problem as long as I wouldn't send anything over RS232. After I have send something to my generator (and closed the com-port again), the next VISA-Command will give me a error (VI_ERROR_ABORT). Now, I can open a new Session and everything is working normal again (until I send again something over the com-port).

 

For me is it a really strange issue. Any ideas? Any help?

 

Best regards

Michael

 

 

0 Kudos
Message 1 of 4
(4,234 Views)

Are you sure that the COM port parameters (baud rate, parity, stop bit...) are configured correctly and according to your hardware defaults?

Just an idea...

0 Kudos
Message 2 of 4
(4,200 Views)

Dear Michael,

 

I only can give you rough hint. Maybe you mix up your VISA sessions. Is your other VISA session really closed before you start the GPIB VISA session?

 

Regards, Topp

0 Kudos
Message 3 of 4
(4,158 Views)
Solution
Accepted by topic author Cumulus

OK, finally I've found the problem.

 

When you use the serial port, you can write data with the normal write-function (WriteFile()) or with the advanced one (WriteFileEx()). Don't ask me now for the details about the difference, it's something with the overlapped-mode...

 

After I have send any data with WriteFileEx, the VISA-connection over GPIB produced an error. So I switched to the basic WriteFile() and everything works. Don't ask my for the coherence betwenn VISA (with GPIB, and only with GBIB) and the serial connection. I'm just happy at the moment...

 

Michael

 

 

0 Kudos
Message 4 of 4
(4,139 Views)