From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using VISA Write to input a hex shortcut

Hi,
I am communicating over a serial port with another device.
This device requires hex shortcuts where the most significan byte has been set.
Example: 0xA6 10100110
 
I want to use VISA Write to send this to my device. VISA Write takes a string, but if I try to write in A6 (in hex display for instance) this is not understood by my device.
 
Any ideas what I may be doing wrong?
0 Kudos
Message 1 of 7
(3,780 Views)
I suppose your are sending order to your device with a string mode as follow :
    viPrintf (GPIB_ID, command);
where command is your string.


You should write directly on the GPIB bus the byte in binary mode :
    viWrite(GPIB_ID, (ViBuf) buffer, lSize, &actual);
buffer is your byte array,, lsize the number of bytr you are goind to send on the bus.
0 Kudos
Message 2 of 7
(3,763 Views)
If you are using C language, type \xA6 in the string to send.  This is control char expression of standard C languages.
0 Kudos
Message 3 of 7
(3,753 Views)
I don't nd messages to the device in a c environment, I am using LabVIEW's VISA Write vi.
The problem is that this vi takes an input string, and I have not found a way of manipulating this string so that it sends over the command I would like it to.
 
As it is a case of putting the right data into the buffer, this should be possible (?)
0 Kudos
Message 4 of 7
(3,742 Views)
In LabVIEW You can change the string control (right mouse click) to show hex or pasword setting or /codes and even normal view.
In this mode you also can type in HEX.

Remember
 Instruments that want hex strings normally don't want what is in the manual but a binary value that in the manual is typed in hex representation.

So put your control in hex mode and try it with your instrument.



greetings from the Netherlands
Message 5 of 7
(3,729 Views)

I have tried putting the input string into hex mode and writing my code there (in HEX). This doesn't work.

As far as I know, I cannot change VISA Write to work in another mode, som I'm still stuck.

0 Kudos
Message 6 of 7
(3,691 Views)