
Operation,
Remote Operation
139187 / Rev. 500
RGS-2000NG TCAS Test Set Operation Manual
1-2-5
September 2021
Subject to Export Control. See Cover Page for details.
Page 241
//=============================================================================
// Function Name: ReadAndStoreIntoBuffer()
// Purpose: Reads over GPIB and stores the result into a buffer.
// Parameter List: instHandle - VISA session handle
// Return Values: Zero on success, non-zero otherwise
//=============================================================================
static long ReadAndStoreIntoBuffer( ViSession instHandle )
{
long device = 0 ;
unsigned long ret_count = 0 ;
long status ;
if ((status = RGS_nxtCmdWait (instHandle)) < 0)
return status;
status = viRead( instHandle, (unsigned char*) saved_buffer[d evice],
511, &ret_count );
// Log this as the last command transmission time
if ((status = RGS_nxtCmdLog (instHandle, WAITTIME0_03)) < 0)
return status;
saved_buffer[device][ret_count] = 0 ;
if( status < 0 )
return status ;
is_buffer_occupied[device] = (ret_count>0)?1:0 ;
return status ;
}
//=============================================================================
// Function Name: ClearStoredBuffer()
// Purpose: Clears the buffer.
// Parameter List: instHandle - VISA session handle
// Return Values: Zero on success, non-zero otherwise
//=============================================================================
static void ClearStoredBuffer( ViSession instHandle )
{
long device = 0 ;
saved_buffer[device][0] = 0 ;
is_buffer_occupied[device] = 0 ;
}
//=============================================================================
// Function: Boolean Value Out Of Range - ViBoolean
// Purpose: This function checks a Boolean to see if it is equal to VI_TRUE
Example Program (cont)