Performing Measurement Tasks - Programming Examples
R&S
®
NRPxxTWG
98
User Manual 1178.8371.02 ─ 04
// Auto Averaging OFF and set Average Count = 4
SENSOR.write( "SENS:AVER:COUN:AUTO OFF" );
SENSOR.write( "SENS:AVER:COUN 4" );
// Select the trigger source
if ( bUseBUSTrigger )
{
// We want to use '*TRG' to trigger a single physical measurement
SENSOR.write( "TRIG:SOUR BUS" );
}
else
{
// We get trigger pulses on the external input (SMB-type connector)
SENSOR.write( "TRIG:SOUR EXT2" );
}
// Auto-Trigger OFF
SENSOR.write( "TRIG:ATR:STAT OFF" );
// Configure a buffered measurement
// Buffer size is randomly selected to 17
SENSOR.write( "SENS:BUFF:SIZE 17" );
SENSOR.write( "SENS:BUFF:STAT ON" );
SENSOR.write( "TRIG:COUN 17" );
// Read out all errors / Clear error queue
SENSOR.query( "SYST:ERR:ALL?", szBuf, sizeof( szBuf ) );
printf( szBuf );
// Start a 'single' buffered measurement
// Since 17 trigger-counts have been configured,
// the 'single' buffered measurement, which becomes
// initiated by INIT:IMM, is not over until
// 17 physical measurements have been triggered
SENSOR.write( "INIT:IMM" );
// The end of a physical measurement can be recognized
// by a transistion to 'NOT MEASURING' which is a
// negative transistion on bit 1
SENSOR.write( "STAT:OPER:MEAS:NTR 2" );
SENSOR.write( "STAT:OPER:MEAS:PTR 0" );
// Collect 17 physical measurements
for ( int i = 0; i < 17; i++ )
{
// As a pre-condition: clear the event register by reading it
int iDummy;
SENSOR.query( "STAT:OPER:MEAS:EVEN?", &iDummy );
Performing a Buffered Continuous Average Measurement