09-03-2015 01:25 AM
Hi,
I'm trying to interface with a HP 3497A Option 110.
This is my code:
try { _dev = new Device(boardIndex, 9); _dev.Clear(); _dev.Reset(); _dev.Write(ReplaceCommonEscapeSequences("DR3")); _dev.Write(ReplaceCommonEscapeSequences("DL3")); string resp = InsertCommonEscapeSequences(_dev.ReadString()); _dev.GoToLocal(); } catch (NationalInstruments.NI4882.GpibException ex) { }
Highlighted in red is my issue. In order for me to read the response from the device, I have to call _dev.Write(ReplaceCommonEscapeSequences("DR3")) twice or I get a read timeout error.
If I call it only once, I get a timeout error, but calling it twice works.
Can anyone explain this?
This happens for other options as well.
Thanks!
09-03-2015 09:29 AM
Before going to all of the trouble of writing code, I would have verified communication first using NI-488.2 Interactive Control available through NI-MAX.
09-03-2015 10:08 AM - edited 09-03-2015 10:10 AM
Thanks for your reply, but I'm not sure what that would do for me. I appreciate the effort though.
Communication works fine. I can read the values from the device, but I'm trying to understand if I'm missing something conceptionally in code since I have to make the above call twice in order to read the value.
Is there an additional command I have to send?
There is not many code example out there using .NET and communicating with older devices. These devices do not respond to *IDN? etc.
The device does show up in NI MAX as GPIB0::9::INSTR
The above code was supposed to be:
try { _dev = new Device(boardIndex, 9); _dev.Clear(); _dev.Reset(); _dev.Write(ReplaceCommonEscapeSequences("DL3")); _dev.Write(ReplaceCommonEscapeSequences("DL3")); string resp = InsertCommonEscapeSequences(_dev.ReadString()); _dev.GoToLocal(); } catch (NationalInstruments.NI4882.GpibException ex) { }
Thanks.
09-03-2015 11:54 AM
@johndcollins wrote:
Thanks for your reply, but I'm not sure what that would do for me. I appreciate the effort though.
Communication works fine. I can read the values from the device, but I'm trying to understand if I'm missing something conceptionally in code since I have to make the above call twice in order to read the value.
Is there an additional command I have to send?
There is not many code example out there using .NET and communicating with older devices. These devices do not respond to *IDN? etc.
The device does show up in NI MAX as GPIB0::9::INSTR
The above code was supposed to be:
try { _dev = new Device(boardIndex, 9); _dev.Clear(); _dev.Reset(); _dev.Write(ReplaceCommonEscapeSequences("DL3")); _dev.Write(ReplaceCommonEscapeSequences("DL3")); string resp = InsertCommonEscapeSequences(_dev.ReadString()); _dev.GoToLocal(); } catch (NationalInstruments.NI4882.GpibException ex) { }
Thanks.
No. Your communication does not work out fine, or you wouldn't have the problem you are having.
09-03-2015 12:04 PM
Ok, thank you for pointing that out.
Can you try and specifiy what I'm supposed to look for in NI MAX?
It looks like it finds the HP 3497A ok.
I have tried this on another setup with similar results.
09-03-2015 12:12 PM
As I wrote above
I would have verified communication first using NI-488.2 Interactive Control available through NI-MAX.
09-03-2015 12:27 PM - edited 09-03-2015 12:44 PM
Sorry, I guess I'm not getting what you mean with "I would verifiy communication first..."
I am communicating with the device. It's responding when I send commands. How do I verify communication.
I've run the NI-488.2 Communicator and it behaves the same way.
I have to send the DL3 command twice or the read will time out...Is that the verification you were looking for?
Here is the I/O Trace for the code above:
Here is the Trace if I don't send the second write command:
09-03-2015 01:37 PM - edited 09-03-2015 01:38 PM
Are you sure that the command does not require a CR or a CRLF ?
Do you have access to the manual?
Perhaps you need to add a delay before a read.
09-16-2015 06:32 PM - edited 09-16-2015 06:32 PM
Thanks for your help..
It was a special eos character that did it.
11-12-2015 05:14 AM
John,
What was the special EOS character that you added? I am having the same issue. I have a system in the field that is working properly but the inhouse system is having the double write issue. I have tried adding every applicable character to the end of my write commands with no luck.