📄 aumg369xb.c
字号:
}
/*=====================================================================================*/
/* Function: Configure VNA Mode */
/* */
/* Purpose: This function configures the frequency offset for the Slave instrument in */
/* the VNA mode. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configureVNAMode (ViSession vi,
ViReal64 VNAOffset)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "SOF %Lf HZ;", VNAOffset));
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure Frequency Marker Enabled */
/* */
/* Purpose: This function enables or disables the marker at the active frequency. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configureFrequencyMarkerEnabled (ViSession vi,
ViInt32 activeFrequency, ViBoolean frequencyMarkerEnabled)
{
ViStatus status = VI_SUCCESS;
if (activeFrequency < 10)
{
CHECKERR (viPrintf (vi, "F%d ME%d;", activeFrequency,
frequencyMarkerEnabled ? 1 : 0));
}
else
{
CHECKERR (viPrintf (vi, "M%d ME%d;", activeFrequency - 10,
frequencyMarkerEnabled ? 1 : 0));
}
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure Frequency Marker Mode */
/* */
/* Purpose: This function configure the frequency marker mode. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configureFrequencyMarkerMode (ViSession vi,
ViInt32 frequencyMarkerMode)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "%s;", frequencyMarkerModeTable[frequencyMarkerMode]));
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*- Power Level Configuration ---------------------------------------------------------*/
/*=====================================================================================*/
/* Function: Configure Power Level Units */
/* */
/* Purpose: This function configures the power level unit. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configurePowerLevelUnit (ViSession vi,
ViInt32 powerLevelUnit)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "%s", powerLevelUnitTable[powerLevelUnit]));
gPowerLevelUnit = powerLevelUnit;
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure Power Level List */
/* */
/* Purpose: This function configures the power level list. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configurePowerLevelList (ViSession vi,
ViReal64 powerLevelList[10])
{
ViStatus status = VI_SUCCESS;
ViInt32 i;
/*- Check input parameter ranges --------------------------------------------------*/
CHECKPARAM (aumg369xb_invalidPointer (powerLevelList), VI_ERROR_PARAMETER2);
/*---------------------------------------------------------------------------------*/
if (gPowerLevelUnit == AUMG369XB_UNIT_LINEAR_MV)
{
for (i = 0; i < 10; i++)
{
CHECKERR (viPrintf (vi, "XL%d %f VT;", i, powerLevelList[i]));
}
}
else
{
for (i = 0; i < 10; i++)
{
CHECKERR (viPrintf (vi, "XL%d %f DM;", i, powerLevelList[i]));
}
}
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure Power Level Entry */
/* */
/* Purpose: This function sets the selected power level. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configurePowerLevelEntry (ViSession vi,
ViInt32 selectedPowerLevel, ViReal64 powerLevel)
{
ViStatus status = VI_SUCCESS;
if (gPowerLevelUnit == AUMG369XB_UNIT_LINEAR_MV)
{
CHECKERR (viPrintf (vi, "XL%d %f VT;", selectedPowerLevel, powerLevel));
}
else
{
CHECKERR (viPrintf (vi, "XL%d %f DM;", selectedPowerLevel, powerLevel));
}
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure Fixed Power Level */
/* */
/* Purpose: This function places the MG369XB in a fixed power level mode and */
/* configures the power level and the level offset. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configureFixedPowerLevel (ViSession vi,
ViInt32 selectedPowerLevel, ViBoolean levelOffsetEnabled,
ViReal64 levelOffset)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "L%d, LO%d;", selectedPowerLevel, levelOffsetEnabled ? 1 : 0));
if (levelOffsetEnabled)
{
if (gPowerLevelUnit == AUMG369XB_UNIT_LINEAR_MV)
{
CHECKERR (viPrintf (vi, "LOS %f VT;", levelOffset));
}
else
{
CHECKERR (viPrintf (vi, "LOS %f DM;", levelOffset));
}
}
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure 1 dB Below Peak Leveled Power */
/* */
/* Purpose: This function sets the instrument power level to 1 dB below peak leveled */
/* power. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configure1dBBelowPeakLeveledPower (ViSession vi)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "LVP;"));
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure Power Level Sweep */
/* */
/* Purpose: This function places the MG369XB in a power level sweep mode and */
/* configures the dwellTime, the number of steps and the trigger source. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configurePowerLevelSweep (ViSession vi,
ViReal64 dwellTime, ViInt32 numberOfSteps, ViInt32 triggerSource)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "LSP, PDT %f SEC, PNS %d SPS, %s;", dwellTime, numberOfSteps,
triggerSourceTable[triggerSource]));
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure ALC Mode */
/* */
/* Purpose: This function configures the leveling mode and the attenuation, enables or*/
/* disables decoupling the step attenuator from the ALC. This function */
/* permits setting of the Reference Level DAC to control the ALC gain when in*/
/* external power leveling mode. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configureALCMode (ViSession vi,
ViInt32 levelingMode, ViBoolean decoupleEnabled,
ViInt32 attenuation, ViInt32 referenceLevelDAC)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "%s, AT%d;", levelingModeTable[levelingMode],
decoupleEnabled ? 1 : 0));
if (decoupleEnabled)
{
CHECKERR (viPrintf (vi, "ATT%02d;", attenuation));
}
if (levelingMode == AUMG369XB_LEVELING_MODE_EXTERNAL_DETECTOR ||
levelingMode == AUMG369XB_LEVELING_MODE_POWER_METER)
{
CHECKERR (viPrintf (vi, "EGI %d SPS;", referenceLevelDAC));
}
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure ALC Loop */
/* */
/* Purpose: This function turns on or turns off the ALC power slope function and */
/* configures the the pivot point frequency and the ALC power slope. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configureALCLoop (ViSession vi,
ViReal64 pivot, ViBoolean slopeEnabled, ViInt32 slope)
{
ViStatus status = VI_SUCCESS;
CHECKERR (viPrintf (vi, "PVT %Lf HZ, SL%d;", pivot, slopeEnabled ? 1 : 0));
if (slopeEnabled)
{
CHECKERR (viPrintf (vi, "SLP %d SPS;", slope));
}
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*=====================================================================================*/
/* Function: Configure Power Offset Table */
/* */
/* Purpose: This function enables or disables the power offset table and loads a */
/* power offset table. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configurePowerOffsetTable (ViSession vi,
ViBoolean powerOffsetTableEnabled, ViInt32 numberOfPowerOffset,
ViReal64 powerOffsetList[])
{
ViStatus status = VI_SUCCESS;
ViChar command_str[10000];
ViChar *ptr = VI_NULL;
ViInt32 i;
ViUInt32 returnCount;
ViInt16 powerLevel;
/*- Check input parameter ranges --------------------------------------------------*/
CHECKPARAM (aumg369xb_invalidPointer (powerOffsetList), VI_ERROR_PARAMETER3);
/*---------------------------------------------------------------------------------*/
if (powerOffsetTableEnabled)
{
command_str[0] = 'P';
command_str[1] = 'T';
command_str[2] = 'L';
ptr = (ViChar*)(&numberOfPowerOffset);
command_str[3] = (ViChar)(*ptr);
command_str[4] = (ViChar)(*(ptr + 1));
for (i = 0; i < numberOfPowerOffset; i++)
{
powerLevel = (ViInt16)(100 * powerOffsetList[i]);
ptr = (ViChar*)(&powerLevel);
command_str[5 + 2 * i] = (ViChar)(*ptr);
command_str[6 + 2 * i] = (ViChar)(*(ptr + 1));
}
CHECKERR (viWrite (vi, command_str, 5 + numberOfPowerOffset * 2, &returnCount));
}
CHECKERR (viPrintf (vi, "PT%d;", powerOffsetTableEnabled ? 1 : 0));
CHECKERR (aumg369xb_checkStatus (vi));
Error:
return status;
}
/*- Modulation Configuration ----------------------------------------------------------*/
/*=====================================================================================*/
/* Function: Configure Internal AM */
/* */
/* Purpose: This function turns on or turns off the selected internal AM function */
/* and configures the depth, the rate and the waveform. */
/*=====================================================================================*/
ViStatus _VI_FUNC aumg369xb_configureInternalAM (ViSession vi,
ViBoolean InternalAMEnabled, ViInt32 scaling, ViReal64 depth,
ViReal64 rate, ViInt32 waveform)
{
ViStatus status = VI_SUCCESS;
if (InternalAMEnabled)
{
if (scaling == AUMG369XB_AM_SCALING_LINEAR)
{
CHECKERR (viPrintf (vi, "AM7, ADP1 %f PCT;", depth));
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -