Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Instron 8800 Control Timeout Issue using NI-VISA (VISA Error code: -1073807339) in C# Application

I've written an application using C# which queries an Instron 8800 controller (very old controller).  While the program is running I get seemingly random timeout errors (error code defined in title), which eventually lead to an EABO error.  The program will typically start and query fine for 2 - 3 iterations, and then give the aforementioned timeout error.  It will then work for another few iterations and timeout again.

 

I've adjusted bus timing values per Instron's suggestion, but to no avail--does anyone have any ideas?  I've attemped using both the GpibInterface and MessageBasedSession classes.

 

Code below:

using NationalInstruments.VisaNS;

namespace niVISAInstronTest
{
public partial class Form1 : Form
{
private MessageBasedSession mbSession;
private GpibInterface instron_GPIB;

private void button1_Click(object sender, EventArgs e) { timer_Cyclic.Enabled = true; textBox1.Enabled = false; button1.Enabled = false; GPIB_Address = textBox1.Text; instron_GPIB = new GpibInterface(GPIB_Address, AccessModes.NoLock, 0, false); instron_GPIB.SendEndEnabled = true; instron_GPIB.Timeout = 10000; } private void timer_Cyclic_Tick(object sender, EventArgs e) { WriteToConsole(Query("Q210").ToString()); } /// <summary> /// 500ms timeout seems to work best so far /// </summary> /// <param name="query"></param> /// <returns></returns> public double Query(string query) { double response = -1; try { //response = double.Parse(mbSession.Query(query)); instron_GPIB.Write(query); string response_s = instron_GPIB.ReadString(); response = double.Parse(response_s); return response; } catch (Exception EX) { WriteToConsole(EX.GetBaseException().ToString()); } return response; } public void WriteToConsole(string msg) { textBox_Console.Text += Environment.NewLine + msg; textBox_Console.SelectionStart = textBox_Console.TextLength; textBox_Console.ScrollToCaret(); }

 

0 Kudos
Message 1 of 10
(5,836 Views)

Try NI-488.2 instead of VISA.

 

I once had old HP counters, and I found that using NI-488.2 worked better with them.

 

 

Message 2 of 10
(5,830 Views)

I have re-written the program utilizing Ni-488.2 libraries, but am still having a similar issue.  Is there any other things that I could try (I have posted the new code below):

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using NationalInstruments.NI4882;

namespace niVISAInstronTest
{
    public partial class Form1 : Form
    {
        Device instron_GPIB;
                
        public Form1()
        {
            InitializeComponent();
        }

        
        private void button1_Click(object sender, EventArgs e)
        {
            
            timer_Cyclic.Enabled = true;
            textBox1.Enabled = false;
            button1.Enabled = false;

            instron_GPIB = new Device((int)0, (byte)1);
            
            instron_GPIB.IOTimeout = TimeoutValue.T1s;         

        }

        private void timer_Cyclic_Tick(object sender, EventArgs e)
        {
            try
            {

                instron_GPIB.Write("Q210\\r\\n");

                WriteToConsole(instron_GPIB.ReadString());

                

                instron_GPIB.Wait(GpibStatusFlags.IOComplete);

            }
            catch (Exception ES)
            {
                WriteToConsole(ES.ToString());
            }

        }

       
        public void WriteToConsole(string msg)
        {
            textBox_Console.Text += Environment.NewLine + msg;

            textBox_Console.SelectionStart = textBox_Console.TextLength;
            
            textBox_Console.ScrollToCaret();
        }

      
    }
}

 

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

I would personally put in a hard delay between Write and Read and see what happens.

 

Message 4 of 10
(5,795 Views)

Just a System.Threading.Thread.Sleep(500)?  I'll give that a shot--I haven't tried that with NI488.2 libraries yet (though I did try with NI-VISA).  Thanks again for your assistance, i'll report back with how it works!

0 Kudos
Message 5 of 10
(5,788 Views)

@engineerjames1987 wrote:

Just a System.Threading.Thread.Sleep(500)?


Right.

 

It may be that the instrument needs just a CR or just a NL.

Message 6 of 10
(5,781 Views)

Even after tryiing that I'm still getting seemingly random timeout (EABO) issues.  I would assume that I might have a hardware problem if there wasn't a LabVIEW program that essentially does the same thing that works perfectly fine.  I've posted a portion of the NI I/O Trace (Though I admit I'm not quite sure what everything means):

 

NIIOTrace.jpg

 

Any further ideas?

0 Kudos
Message 7 of 10
(5,743 Views)

What is the most recent piece of code that created this NI I/O Trace and how did it differ from the previous iteration? Do you observe any change when implementing the timing suggestions that were suggested above?

National Instruments
Message 8 of 10
(5,722 Views)

The second chunk of code posted is the one that created the NI I/O Trace shown above.  To be honest, everything I have tried has ended in the same result (random EABO error/timeout errors).  There is an integrated part of Instron software that can query the controller (and has 0 problem doing so)--I happened to also do a trace to potentially isolate any differences:

 

NIIOTraceMaint17Sep14.JPG

 

To me the only difference between the two is using Send vs. ibwrt on the write command but I am not a pro by any means.

0 Kudos
Message 9 of 10
(5,715 Views)

It looks like the LabVIEW code is using the higher level NI-VISA and not NI-488.2.

Can you confirm?

 

So, if that is what they are doing, switch back to using NI-VISA while keeping the delay.

0 Kudos
Message 10 of 10
(5,713 Views)