Making A Frequency Measurement (C) - Keysight 53147A Operating And Programming Manual

Microwave frequency counter/power meter/dvm
Table of Contents

Advertisement

Making a Frequency Measurement (C)

/* This program configures the instrument to make 10 frequency measurements
on channel 1 followed by 10 frequency measurements on channel 2, 10
power measurements, and 10 voltage measurements.
The results are displayed on the computer monitor.
The program comments discuss the meaning of each command.
ASCII result format is used to preserve resolution. */
#include <stdio.h
#include <string.h
#include "CGPIB.H"
#include "CFUNC.H"
void sendhp(char *);
long ctr=703;
int
void main()
{
void sendhp(gpib_cmd)
char *gpib_cmd;
{
char hpcmd[80];
int length;
strcpy(hpcmd, gpib_cmd);
length=strlen(hpcmd);
error=IOOUTPUTS(ctr, hpcmd, length); /* Send command to Keysight 5314xA
if (error!=0)
printf("Error during GPIB: %d Command %s\n",error,hpcmd);
}
Sendhp( ":CONF:FREQ DEFAULT,DEFAULT,(@1)"); /* Set to Band 1
Sendhp( "INIT:IMM");
Sendhp( "READ?")
IOENTERS(ctr,freq,&length);
length=strlen(freq);
freq[length-1]='\0' ;
printf ("Frequency in Band 1
printf("Press a key to continue\n");
getch();
Keysight 53147A/148A/149A Operating and Programming Guide
/* instrument is at address 03. GPIB is at select code 7
error;
long isc=7;
int state=1;
int i;
int samples=10;
int length=23;
char freq[23];
IORESET(isc);
sendhp("*RST");
sendhp("*CLS");
sendhp("*SRE 0");
sendhp("*ESE 0");
sendhp(":STAT:PRES");
IOEOI(isc,state);
/* function to send command to instrument
/* global data
/* Select code 7
/* Used in IOEOI
/* Used for loop instrument
/* Number of measurements to take
/* Max number of bytes per measurements
/* Array to hold frequency string
/* Clear the GPIB interface
/* Reset the instrument
/* Clear event registers and error queue
/* Clear service request enable register
/* Clear event status enable register
/* Preset enable registers and transition
filters for operation and questionable
status structures
/* Enable use of EOI
/* Function to send command to Keysight 5315xA
/* Variables used by function
/* Trigger new measurement
/* Get measurement
/* Fetch the data
= %s Hz\n",freq);
Programming
3
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
205

Advertisement

Table of Contents
loading

This manual is also suitable for:

53148a53149a

Table of Contents