Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

buffer format questions of viWrite.

I'm very confused about the use of viWrite, I just want to have 4 numbers:33 44 55 and 66 sent out. if I use the following expressions, will the spaces simply act as a seperators or not?  I know in Labview, if you use VISA Write control and wire "buffer write" port with a string of "33 44 55 66", the spaces will just be dealed as seperators . 
 
 
//-----------------------------------
ViByte buf[100]="33 44 55 66";
 viCheckErr( viWrite(io, (ViBuf)buf, count, &retCnt)); //retCnt==11?
  viCheckErr(viFlush (io, VI_ASRL_OUT_BUF)); 
0 Kudos
Message 1 of 2
(3,115 Views)
By your example code, the following 11 bytes will be sent:
 
[0] = 0x33 ('3')
[1] = 0x33 ('3')
[2] = 0x20 (' ')
[3] = 0x34 ('4')
[4] = 0x34 ('4')
[5] = 0x20 (' ')
[6] = 0x35 ('5')
[7] = 0x35 ('5')
[8] = 0x20 (' ')
[9] = 0x36 ('6')
[10] = 0x36 ('6')
 
VISA viWrite() or its LabVIEW equivalent does not treat space code (0x20) in data as any special means.  Therefore these space codes will be sent to your instrument as is.  Depending on the instrument, these space codes have different meaning.  Some instrument may consider them as separaters but others may not.
0 Kudos
Message 2 of 2
(3,112 Views)