Agilent Technologies FS2010 Manual de servicio Pagina 162

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 396
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 161
154 Agilent Signal Generators Programming Guide
Programming Examples
RS-232 Programming Interface Examples (ESG/PSG Only)
//****************************************************************************************
// PROGRAM NAME: rs232ex1.cpp
//
// PROGRAM DESCRIPTION: This code example uses the RS-232 serial interface to
// control the signal generator.
//
// Connect the computer to the signal generator using an RS-232 serial cable.
// The user is asked to set the signal generator for a 0 dBm power level
// A reset command *RST is sent to the signal generator via the RS-232
// interface and the power level will reset to the -135 dBm level.The default
// attributes e.g. 9600 baud, no parity, 8 data bits,1 stop bit are used.
// These attributes can be changed using VISA functions.
//
// IMPORTANT: Set the signal generator BAUD rate to 9600 for this test
//****************************************************************************************
#include <visa.h>
#include <stdio.h>
#include "StdAfx.h"
#include <stdlib.h>
#include <conio.h>
void main ()
{
int baud=9600;// Set baud rate to 9600
printf("Manually set the signal generator power level to 0 dBm\n");
printf("\n");
printf("Press any key to continue\n");
getch();
printf("\n");
ViSession defaultRM, vi;// Declares a variable of type ViSession
// for instrument communication on COM 2 port
ViStatus viStatus = 0;
// Opens session to RS-232 device at serial port 2
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM, "ASRL2::INSTR", VI_NULL, VI_NULL, &vi);
if(viStatus){// If operation fails, prompt user
printf("Could not open ViSession!\n");
Vista de pagina 161
1 2 ... 157 158 159 160 161 162 163 164 165 166 167 ... 395 396

Comentarios a estos manuales

Sin comentarios