Chapter 3 Programming Your Universal Counter for Remote Operation
Programming Examples
3-96
Programming Guide
To Optimize Throughput (Turbo C)
/* This program sets up the counter to transfer data at the fastest
possible rate. Note that the arming mode is AUTO. This mode provides
the least resolution of all the arming modes.
The program comments discuss the meaning of each command.
ASCII result format is used to preserve resolution.
For optimal performance, compile for best speed. */
#include <stdio.h> /* used for printf() */
#include <string.h> /* used for strlen() */
#include "CHPIB.H" /* HP-IB library constant declarations */
#include "CFUNC.H" /* HP-IB library function prototypes */
void sendhp(char *); /* function to send command to counter */
/* global data */
long ctr=703; /* Counter is at address 03. HP-IB is at select code 7 */
int error;
void main()
{
long isc=7; /* Select code 7 */
int status; /* Used in IOSTATUS */
int state=1; /* Used in IOEOI */
int i; /* Used for loop counter */
float exp_freq; /* Expected frequency value */
int readings = 1000; /* Number of measurements to take */
int length=23; /* Max number of bytes per measurement */
char freq[1001][23]; /* Array to hold measurements */
char destination[130]; /* Used for expected frequency */
IORESET(isc); /* Clear the HP-IB interface */
sendhp("*RST"); /* Reset the counter */
sendhp("*CLS"); /* Clear event registers and error queue */
sendhp("*SRE 0"); /* Clear service request enable register */
sendhp("*ESE 0"); /* Clear event status enable register */
sendhp(":STAT:PRES"); /* Preset enable registers and transition
filters for operation and questionable
status structures */
IOEOI(isc,state); /* Enable use of EOI */
sendhp(":FUNC 'FREQ 1'"); /* Make a frequency measurement */
sendhp(":FREQ:ARM:STAR:SOUR IMM"); /* These 2 lines enable the */
sendhp(":FREQ:ARM:STOP:SOUR IMM"); /* AUTO arming mode*/
sendhp(":EVENT1:LEVEL 0"); /* Set a trigger level for
channel 1. This disables the
auto trigger, increasing
throughput */
Summary of Contents for 53131A
Page 1: ...Programming Guide HP 53131A 132A 225 MHz Universal Counter ...
Page 2: ......
Page 13: ...1 1 Before You Start ...
Page 24: ...Chapter 1 Before You Start Related Documentation 1 12 Programming Guide ...
Page 25: ...2 2 Command Summary A Quick Reference ...
Page 68: ...Chapter 2 Command Summary RST Response 2 44 Programming Guide ...
Page 69: ...3 3 Programming Your Universal Counter for Remote Operation ...
Page 167: ...4 4 Command Reference A Dictionary ...
Page 310: ...Chapter 4 Command Reference WAI Wait to Continue Command 4 144 Programming Guide ...
Page 311: ...5 5 Errors ...
Page 329: ......
Page 330: ...H Manual Part Number 53131 90044 Printed in U S A NOVEMBER 1996 ...