Hi All,
First the pertinent details:
- VXI-11.3 Compliant ICS Electronics Model 8099 - Ethernet/MODBUS Interface controlling a Watlow F4 Temperature Controller
- NI-VISA 4.5.1 (licensed)
- CentOS Release 5.5
- TCP/IP connection to the device (direct connection with crossover cable as well as through a network - both produce similar behavior)
The connection to my device is over TCP/IP (I've tried both through my network and with a direct connection through a crossover cable - both seem to work the same).
Using the NI-VISA C library, I've written a few wrapper functions which are called from Python. Specifically, I'm using the NI-VISA functions (viOpen, viRead, viWrite, viClose), and that's it. In my Python script, I open a session to the device (without problem), and then I enter a loop which calls viWrite, waits for a response, then viRead and waits for a response, then repeats.
The problem I am seeing is that after a random number of (successful) iterations through the loop, I'll get a connection lost error (0xBFFF00A6). I can then immediately restart my script which will reestablish the connection, and things progress fine until I get another connection lost error. This led me to attempt to reestablish the connection (viOpen) each iteration through the loop, followed by a viClose at the end of the loop. This still produces the same behavior of a random number of successful iterations through the loop. Upon receiving the connection lost error, I am still able to successfully ping the TCP/IP device which leads me to believe it's not a network connection problem.
From my understanding, since I am using the synchronous viWrite, I am not writing to a write buffer, but instead directly to the device, thus there should be no need to flush any buffer contents. The same goes for my viRead calls. I am at a loss as to how to explain this behavior, so any ideas or suggestions would be greatly appreciated.
Thanks!