LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IEEE write converted from C

Solved!
Go to solution

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

 

 

 

 

 

0 Kudos
Message 1 of 4
(2,334 Views)

Hi RW,

 

10. ist just a float value of 10...

 

You can/should replace those old gpib functions by Visa calls.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,307 Views)

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

0 Kudos
Message 3 of 4
(2,301 Views)
Solution
Accepted by topic author RWCarlson

It would look something like this..

Varian_FR41_VISA_write.png

 

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

Message 4 of 4
(2,279 Views)