LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing numbers in Visa

Hello All

    viWriteBuffer[20] = 0x00;
    
    sprintf( timeInterval, "0x%X", txInterval );
    
    viWriteBuffer[21] = *timeInterval;        //time period - set to 10 seconds for now  (0x0A)
    
            
        status = viWrite( gateway, viWriteBuffer, viWriteBufferSize, viWriteDataSize );

I have a buffer (viWriteBuffer) which I am using to send a message to VISA.  The last byte, I take a number from a numeric control, convert it to hex, and then write that number to VISA.  However, when I look at the message I am sending to visa, the writeBuffer variable shows that I am always sending a 0x30, no matter what I change the numeric to.  Does anyone know if this is a formatting issue with VISA and if there is any way around it?
Note:  The variable timeInterval is associated with the right numbers (if my numeric control is set to 15, the timeInterval variable associated with viWriteBuffer[21] is equal to 0x0F...)

neemtt
0 Kudos
Message 1 of 2
(3,042 Views)

But seeing as how you are writing either the value "0x0A" or "0x0F" into the string variable timeInterval, it is not surprising that the first character shows as 0x30 - this being the ASCII value of the leading "0" in your string.

JR

0 Kudos
Message 2 of 2
(3,039 Views)