HP (Hewlett-Packard) HP 53131A Water Dispenser User Manual


 
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 */