09-09-2014 12:51 PM
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(); }
09-09-2014 01:56 PM
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.
09-12-2014 02:35 PM
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(); } } }
09-12-2014 02:38 PM
I would personally put in a hard delay between Write and Read and see what happens.
09-12-2014 03:10 PM
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!
09-12-2014 03:50 PM
@engineerjames1987 wrote:
Just a System.Threading.Thread.Sleep(500)?
Right.
It may be that the instrument needs just a CR or just a NL.
09-16-2014 08:56 AM
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):
Any further ideas?
09-17-2014 04:35 PM
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?
09-17-2014 06:49 PM
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:
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.
09-17-2014 07:09 PM - edited 09-17-2014 07:14 PM
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.