05-23-2019 02:01 PM
Hello all. Forgive me for the somewhat basic question, but I'm trying to control an old magnet control gaussmeter (Varian FR41) and the old C code looks like this:
{
long temp;
int z1,z2,z3,z4,b1,b2,b3;
float b;
double gauss,hv=9555.,magconst=.069,Mass=171.;
if (ieeeinit()==-1)
{
printf("Cannot initialize IEEE system.\n");
exit(1);
}
gauss=sqrt(Mass*hv/magconst);
temp=10*gauss;
b=temp/10.;
z1=b/1000;
z2=b/100;
z3=b/10;
z4=b;
printf("\n\r %f %f %d %d %d %d",gauss,b,z1,z2,z3,z4);
b1=z2+z1*6;
b2=z4+6*z3-160*z2;
b3=(b-z4)*160+14;
printf("\n\r %d %d %d %d",7,b1,b2,b3);
ieeewt("output 08;");
ieeeprtf("%c%c%c%c\n",7,b1,b2,b3);
}
I'm having trouble with the conversion to LabView in two areas. First, the in the line
b=temp/10.;
I do not know how to reproduce the "." element selection in LabView.
Lastly, I can't seem to get the
ieeeprtf("%c%c%c%c\n",7,b1,b2,b3);
to communicate with the instrument using the GPIB Send Message.vi. Is there another solution to sending characters to the instrument through the GPIB hub?
Thanks,
Jesse
Solved! Go to Solution.
05-23-2019 02:41 PM
05-23-2019 02:50 PM
Thanks for the reply, but I'm afraid I still don't follow (again, new to LabView). Can you give me some specific examples to help me out?
Jesse
05-23-2019 03:52 PM
It would look something like this..
You'll need NI-VISA installed on your PC.
You'll want to get the format of your command string right (see manual).
If I were you I would also look up how to query the Varian for errors, then send that command to it and read the response. For that you would issue a VISA write, delay say 1s, VISA read.
Craig