Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Output decimal number through GPIB or VISA

I was wondering if it is possible to output a decimal number, as in not a string, through the GPIB or VISA commands. I am trying to communicate with a machine that I think wants to get a number, and can't understand what I am sending when it is in a string format.

thanks
0 Kudos
Message 1 of 2
(2,920 Views)
It is possible to transmit such a number over GPIB. I would double check the instrument manual for what it requires. I'm going to assume that you are using a long to represent a floating pont number. Here is some example code for how you would pass this number to the GPIB ibwrt() function.

int ud = ibdev(board,PAD,SAD,timeout,eot,eos);
long myNumber = 4.2;
ibwrt(ud, &myNumber, sizeof(long));

Essentially, the driver will break down the 32-bit number into 4 8-bit chunks.

Craig A.
National Instruments Engineer
0 Kudos
Message 2 of 2
(2,920 Views)