10-07-2020 02:12 AM
I tried to write a code in Delphi to control my instrument(Keithly6221). The instrument is connected and as soon as I run the programme it shows -113 error(undefined header). and i can't communicate with the instrument. please suggest me How to overcome issue.
10-07-2020 01:46 PM
You might look at these threads:
https://forums.ni.com/t5/LabVIEW/113-quot-undefined-header-read-quot-error-1074000000/td-p/3579277
Otherwise I think no one will answer this question without more complete and precise information (code, NIMAX trace etc.).
10-08-2020 12:08 AM
Thanks for Your Reply.
I wrote a code I am attaching that one in a text file.
All SPCI commands are correct as per the instrument instruction manual. same SPCI command works well in MAX instrument communication section.
please take look. looking forward to hearing from you.
10-08-2020 12:46 PM
You don't tell which line causes the problem and I don't see there any instruction displaying device error messages from the instrument in this code so maybe the error comes from a different unit. You have to run the code under the debugger (it's good to learn using the debugger in general) to see which line of code generates the message and after which gpib command.
10-09-2020 06:38 AM
I think there is an issue with the last part in the code where I have created new function SendToGenerator
procedure TForm1.SendToGenerator(command: string);
begin
strcopy(Vstr, '');
strcopy(Vstr, pchar(command));
ibwrt(Dev3, VStr, strlen(VStr));
if (Pibsta^ AND ERR) <> 0 THEN
GPIBCleanup('Unable to write to device');
end;
Progam run well without showing any error even not any warning but as soon as I start the communication with the instrument. there is -113 error on the instrument display (undefined header). when I stared at any communication the first call is made to this function which has to contains some problem so that it's showing an error after its execution.
10-09-2020 12:30 PM
Apparently your instrument does not recognize the sequence of characters in Vstr as a valid command. Put a breakpoint in the line
ibwrt(Dev3, VStr, strlen(VStr));
to check what is the string being actually sent to your device.
10-19-2020 01:11 AM
We have checked multiple times that what is the command string been sent to the instrument after the command executed (by using show message function). The string value and its sequence are okay but still showing error.
even we have checked the command ibwrt by entering the value of strlen externally still showing error.
10-19-2020 05:02 AM
Did you observe the communiction with NI IO-Trace ? Could it be , that your Command Strings lack termination characters ( like carriage return and/or line feed) which your device expects ?
10-19-2020 07:02 AM
Can you please elaborate little how to plot the NI IO-Trace? I never did this, so I can do that and get back to you.
Secondly, I have checked well carefully the SPCI command that drives the instrument and its termination, from instrument manual, and even displayed what string I'm carrying to the instrument before and after the execution of the SendToGenrator function.
If required I have provided my code in .txt format in the past discussion. please take look.
looking forward to hearing from you soon