Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB OutOfMemoryException

Solved!
Go to solution

I have run across a very puzzling issue.  I am running an extended test (3 days) on a test station and after 24-36 hours, I keep getting a System.OutOfMemoryException.  each time it is raised through the GPIB driver.  Here is my setup.  I am running VB.NET 2008 on a Windows 7 32-Bit OS.  The GPIB driver is the NI-488.2 Version 2.7.3.  I am making continuous calls to the GPIB to read from devices and multiplex between devices.  I have even run a program in the background that logs system available memory as well as memory usage of all processes.  I have not seen any evidence that the system memory has dropped by much.  Granted, I have only been logging memory usage every 15 seconds, but I have been trying to avoid creating huge log files trying to find this issue.  Could there be an issue with the .NET driver?  Or maybe the way that I'm using it?  This has been the most intense usage of GPIB that we have used thus far.  I have not seen any other posts similar to this issue I've run into.  Any help is much appreciated.

 

Mike

0 Kudos
Message 1 of 10
(4,000 Views)
Solution
Accepted by msouza

Hi msouza,

 

There is a forum post with a similar issue here:  http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/While-running-a-net-3-5-application-it-always....  It looks like the problem that this user was having resulted from creating new devices multiple times throughout the program, which caused the exceptions after running for an extended period of time.  It seems like he was able to fix this to only create a new device once for each GPIB device in his setup and the problem went away.  I would suggested reading the suggested practices from this post and ensuring that your code is following them.

Justin D
Applications Engineer
National Instruments
http://www.ni.com/support/
Message 2 of 10
(3,988 Views)

Thank you so much for that feedback.  I was investigating this same thing and noticed that one of engineers set it up to always create a new device every time the GPIB sent a message onto the bus.  I have already updated the code to create the device once and reference that object instead of creating a new one each time.  Glad to hear there is a simple solution to this issue.

 

Mike

0 Kudos
Message 3 of 10
(3,985 Views)

Dear Mike

 

even I am trying to write a GPIB control program using VB.NET. Can you please guide me on how to start. Although I have written many applications in NIDAQmx usage of GPIB and NI-VISA is new for me. Please help

0 Kudos
Message 4 of 10
(3,947 Views)

The simplest example I can find using the NI4882 DLL would be the following example:

 

http://zone.ni.com/devzone/cda/epd/p/id/526

 

They create a device object and perform reads and writes to the device.  A device would be an object on the GPIB bus, such as a power supply.  Once the device is instantiated, you can read and write to the device on the bus to get what you need.  You will need to read the GPIB interface user manual for your device to figure out what commands to send to the device to get you the information you are looking for.   Hope this helps

 

Mike

0 Kudos
Message 5 of 10
(3,938 Views)

Hi Mike

 

Thanks for the reply. I have one more querry.

 

Suppose If I do not have the GPIB interface manual of the device with me, is it possible to debug the commands to be sent using NI I/O trace. Actually my device already has a control application written by the manufacturer using LABview (Manufacturer has made it a closed source software). I have querried the manufacturer for the command instruction set for the device, but there may be a possibility the manufacturer wont divulge the information. So please let me know is there any way out of this situation

 

Thanks

Sarath

0 Kudos
Message 6 of 10
(3,930 Views)

Sarath,

 

I don't know if the trace will give you the information you want, but give it a try.  If not, you can always purchase a GPIB Analyzer card which can be used on a secondary machine and can "listen" on the bus and report back on the traffic.  I started to go down this path as I had an issue and wasn't sure how to debug which command was hanging up the system.  The trace did not help.  I was able to determine the problem before the Analyzer came in so I didn't have to use it to check.  I believe that is what those are designed for though.

 

Mike

0 Kudos
Message 7 of 10
(3,912 Views)

If the card is accessed via LabVIEW you can read via IOtrace what you need.

An analyzer only is useful when timing issues or Low level problems appear.

greetings from the Netherlands
0 Kudos
Message 8 of 10
(3,909 Views)

Dear Mike and Stevens

 

Thank you very much for your prompt replies.

I have one more querry

This is a different querry from the earlier ones.
 
Suppose if I have an USB-Serial Cable. Another PC is connected to the serial port and USB is on my PC. Can I use NI-VISA drivers for this communication purpose. Can I send data like CSV files etc from USB port to the other PC connected by serial port? Please help me on how VISA can be used for this purpose. Examples will help.
 
Thanks
Sarath
0 Kudos
Message 9 of 10
(3,902 Views)

Hi Sarath,

 

I believe I found a similar example/discussion forum to what you're attempting to do.  This example is GPIB communication between two computers.  Take a look and see if this helps any. 

 

http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/GPIB-communication-between-two-computers/m-p/...

Matt S.
Industrial Communications Product Support Engineer
National Instruments
0 Kudos
Message 10 of 10
(3,870 Views)