I have a test mount with an Agilent E4426B radio signal generator connected to a PC via the National Instrument Ethernet-to-GPIB bridge. My software attempts to sanitize the instrument by first tuning it and then storing the current state in all memory locations recorded via the standard SCPI command * SAV x, y.
The loop works to the point, but ultimately the device responds to an error and continuously displays the โLโ icon on the front display and the message โRemote referenceโ at the bottom. At this moment, he will not respond to any more distant commands, and I need to either turn on the power or press LOCAL and then PRESET, at this moment it takes about 3 minutes to complete the preset. At this point, the โLโ icon is still present, and the next GPIB command sent to the tool causes it to report -113 error (undefined header) in the instrument error queue.
I ran an NI spy to find out what was happening and found that the error was in the same place in the loop - "* SAV 6.2" in this case. From NI Spy:
Send (0, 0x0017, "* SAV 6.2", 8 (0x8), NLend (0,0x01))
Process ID: 0x00000520 Topic ID: 0x00000518
ibsta: 0xc168 iberr: 6 ibcntl: 2 (0x2)
And here is the code from the tool driver:
int CHP_E4426b::Erase()
{
if ((m_StatusCode = Initialize()) != GPIB_SUCCESS)
return m_StatusCode;
m_SaveState = "*SAV %d, %d";
for (int i=0; i < 10; i++)
for (int j=0; j < 100; j++) {
sprintf(m_CmdString, m_SaveState, j, i);
if ((m_StatusCode = Send(m_CmdString, strlen(m_CmdString))) != GPIB_SUCCESS)
return m_StatusCode;
}
return GPIB_SUCCESS;
}
I tried to put a slight sleep delay () (10-20 ms) at the end of the inner loop, and, to my surprise, this caused an error that appeared earlier, and not later. 10 ms caused a cycle error at 44.1 and 20 ms even earlier. I already fixed the faulty wiring or tool as the culprit. The same type of sequence works without any errors in the generator of the higher end of the signal, so I am tempted to introduce an error into the firmware of the device.