Programming examples
R&S
®
NRPM
189
Mannual 1425.8663.02 ─ 08
Example: Pseudo code for measuring the power of two antenna modules
This example, written in pseudo code, shows a reduced set of basic steps to set
up and execute a continuous average measurement.
// resource = "NRPM3-100001"
// Open the device
sensor = Open( resource )
// Query the resource identifier and reset the sensor module to default
Query( sensor, "*IDN?" )
Write( sensor, "*RST" )
// Measure only on channels 1 & 3
Write( sensor, "SENS:CHAN1:ENAB ON" )
Write( sensor, "SENS:CHAN2:ENAB OFF" )
Write( sensor, "SENS:CHAN3:ENAB ON" )
Write( sensor, "SENS:FUNC \"POW:AVG\"" )
Write( sensor, "TRIG:SOUR IMM" )
Query( sensor, "SYST:ERR?" )
Query( sensor, "SYST:SERR?" )
Write( sensor, "INIT:IMM" )
Query( sensor, "FETCH:ALL?" )
Close( sensor )
Example: C/C++ (VISA) source code
This sequence shows the VISA source code, based on the
pseudo code
example
above.
// Determine the resource identifier, e.g.
// resource = "NRPM3-100001"
// resource identifier = USB0::0x0aad::0x0195::100001
// Open the device
viOpen( defaultRM, “USB0::0x0aad::0x0195::100001”, VI_NULL, VI_NULL,&session );
// Select the measurement mode
viWrite( session, “SENS:FUNC \”POW:AVG\”\n”, 20, &uiSent );
// Initiate a single measurement
viWrite( session, “INIT:IMM\n”, 9, &uiSent );
// Read the measurement result
viWrite( session, “FETCH:ALL?\n”, 7, &uiSent );
viRead( session, buffer, sizeof(buffer), &uiCnt );
// buffer = “1.468872E-09,3.682521E-10,3.829144E-09”
// Close the device
viClose( session );
Performing measurements in continuous average mode