Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using VISA Write to input floating point number

Hi,
 
I need to send a special command to a device using Visa Write (serial port). It's like "LIMIT 1.1".  "LIMIT" is ASCII string. There is no problem. But "1.1" needs to be a floating point number. If I just put  "LIMIT 1.1" in the command buffer, "1.1" will be ASCII string, not the floating point number which the device requies. How can I make this wok properly?       Thanks.
 
 
 
0 Kudos
Message 1 of 6
(4,084 Views)
Hi Ted

What instrument is this that that does not recognize 1.1 as a float.
maybe somebody has a driver for this instrument if you tell us the name and version of the instrument.

If you need this float in binary form (what I doubt) you could use a typecast from float to array of bytes.
But probably you need something like 1e1 instead of the decimal point, and even in a special number of characters.
Or the end of the string is not recognized

greetings from the Netherlands
0 Kudos
Message 2 of 6
(4,082 Views)

Hi Albert,

Thanks for the quick reply. Most of the commands for the device use ASCII charaters for numbers. Only the special command I mentioned a couple of other similar commands require numbers to be floating point numbers.

A more general question will be:  Is it possible to put different types of data in the Serial VISA WRITE buffer (because the command for VISA WRITE appears to be string only although it can be diplayed differently).

I am not very familiar with Labview. You mentioned typecast from float to array of bytes. How can I put that as a string for Visa write command?

Thanks again.

0 Kudos
Message 3 of 6
(4,070 Views)
Hi

I made you an example of how to convert a single into a four byte array and then into a four byte string. that is accepted by visa
greetings from the Netherlands
0 Kudos
Message 4 of 6
(4,063 Views)

Thank you very much.

I will try it tomorrow.

0 Kudos
Message 5 of 6
(4,055 Views)

The ascii representation of a floating point number is a floating point number.

what representation other than that do you need?

single,double,extended?

and what endian type?

 

greetings from the Netherlands
0 Kudos
Message 6 of 6
(3,572 Views)