?? aumg369xb_example (internal pulse modulation).c
字號:
/*****************************************************************************
* (c) 2007, National Instruments, Corporation. All Rights Reserved. *
*****************************************************************************/
/*****************************************************************************
* ANRITSU, MG369XB Synthesized Signal Generator
* Instrument Driver Sample Program
* Developed with LabWindows/CVI 8.1
* Original Release: 10/20/2007
*
* Purpose: This sample program initializes the synthesized signal generator and
* configures it for internal pulse modulation.
*
* To run this sample program, do the following:
* 1) Create a new project in LabWindows/CVI.
* 2) Add this file to the project. To add files to the project,
* select the Add Files To Project from the Edit menu of the
* Project window.
* 3) Add one of the following files to the project:
* aumg369xb.fp, aumg369xb.c, or aumg369xb.lib.
* 4) Check that the resource name used in aumg369xb_init ()
* function is correct.
* 5) Run the project.
*
* VCC or Borland Users:
* This example uses CVI's MessagePopup() to display the error
* message. You will need to replace this function with a
* printf() or similar display function. You will then need to
* remove the #include <userint.h> statement. You can then follow
* the above directions for CVI users.
******************************************************************************/
#include <cvirte.h>
#include <ansi_c.h>
#include <userint.h>
#include <utility.h>
#include <visa.h>
#include "aumg369xb.h"
/*= Macro ===================================================================*/
#ifndef CHECKERR
#define CHECKERR(fCall) \
if (status = (fCall), (status = (status < 0) ? status : VI_SUCCESS)) \
{ \
goto Error; \
} \
else
#endif
int main (int argc, char *argv[])
{
ViSession vi = NULL;
ViStatus status = VI_SUCCESS;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
/*- Initialize MG369XB synthesized signal generator ---------------------*/
CHECKERR (aumg369xb_init ("GPIB0::5::INSTR", VI_TRUE, VI_TRUE, &vi));
/*- Turn off the RF output ----------------------------------------------*/
CHECKERR (aumg369xb_configureOutputEnabled(vi, VI_FALSE));
/*- Configure the F1 parameter ------------------------------------------*/
CHECKERR (aumg369xb_configureFrequencyEntry(vi, AUMG369XB_FREQUENCY_F1, 2e9));
CHECKERR (aumg369xb_configureCWFrequency(vi, AUMG369XB_FREQUENCY_F1, VI_FALSE, 0, VI_FALSE));
/*- Configure the L1 parameter ------------------------------------------*/
CHECKERR (aumg369xb_configurePowerLevelEntry(vi, AUMG369XB_POWER_LEVEL_L1, -20));
CHECKERR (aumg369xb_configureFixedPowerLevel(vi, AUMG369XB_POWER_LEVEL_L1, VI_FALSE, 0));
/*- Turn on the internal pulse modulation and configure its parameters --*/
CHECKERR (aumg369xb_configureInternalPulseModulation (vi, VI_TRUE, 0.002,
AUMG369XB_INTERNAL_PULSE_MODE_SINGLE, AUMG369XB_TRIGGER_TYPE_FREE_RUN,
AUMG369XB_TRIGGER_EDGE_TYPE_RISING, AUMG369XB_RF_ON_POLARITY_HIGH,
AUMG369XB_CLOCK_RATE_40MHZ_100MHZ));
/*- Turn on the RF output -----------------------------------------------*/
CHECKERR (aumg369xb_configureOutputEnabled (vi, VI_TRUE));
Delay(20);
/*- Turn off the RF output ----------------------------------------------*/
CHECKERR (aumg369xb_configureOutputEnabled(vi, VI_FALSE));
Error:
if (status != VI_SUCCESS)
{
ViChar errorString[256];
aumg369xb_errorMessage (vi, status, errorString);
MessagePopup ("Error!", errorString);
}
if (vi)
aumg369xb_close (vi);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -