/* APPLICATION #3: CONTROLLING VOLTAGE RAMP UP AT TURN ON

FOR MICROSOFT C AND THE Agilent 61062/82990/82335A GPIB COMMAND LIBRARY FOR MS-DOS PROGRAM: Agilent3.C

#include <stdio.h> #include <stdlib.h> #include <string.h> #include "chpib.h” #include "cfunc.h”

#define INTERFACE

7L

#define SLOTO

70500L

#define WTG

32

#define NUM_PTS

20

int error;

main( )

{

char *cmd;

char cmd-buff[255];

static char cr_lf[3] = { 13, 10, 0 }; int i;

float condition_data; float vstart = 2.0; float vstop = 10.0; float vstep[NUM_PTS]; float ramptime = 0.5; float dwell;

dwell = ramptime / 19.0;

/* Select code 7 for the Agilent -1B interface card.

*/

/* Select code 7, mainframe address 05, slot 00. */

/* Waiting for Trigger (WTG) = bit 5 = value 32.

 

*/

/* 20 points in the voltage List.

*/

 

/*

Used to hold command strings sent to the module. */

/*

Used to hold command strings during string manipulations. */

/*

Carriage return+line feed = end of line. */

/*

Loop counter. */

/*

Used to hold data from read back of status conditions. */

/*

Start voltage for the ramp. */

/*

Stop voltage for the ramp. */

/*

Used to hold voltage List points for the ramp. */

/*

Transition time (in seconds) for the ramp. */

/*

Dwell time (in seconds) for each ramp step. */

/*

Since the output stays at the last voltage point after its dwell

 

time expires, the dwelt time of the last point is not part of the transition time.

 

Therefore, divide the total time by 19 points, not 20. You want the same dwell

 

time for every point in the List, so only download 1 dwell time. */

for (i = 1; i <= NUM_PTS; i++)

/*

Calculate the voltage List points */

vstep[i] = vstart + (((vstop - vstart) / NUM_PTS) * i );

 

 

error = ioreset(INTERFACE);

/*

To get the interface to its defaults. */

error_handler(error, "Resetting the interface");

 

 

error = iotimeout(INTERFACE, (double)2.0);

/* Enables timeout of 2 seconds. */

error_handler(error, "Setting the timeout”);

 

 

/* Note regarding GPIB read/write terminations:

The default of the interface card is that EOI is enabled and the read/writes terminate on carriage return/line feed. The module terminates

on either EOI or Line feed, so the default settings of the card are sufficient.

*/

 

cmd = "*RST;*CLS;STATUS:PRESET”;

/*

Reset and clear module. */

 

 

error = iooutputs(SLOTO, cmd, strlen(cmd));

 

 

 

 

error_handler(error, cmd);

 

 

 

 

sprintf(cmd_buff , "VOLT %f”, vstart);

/*

Start ramp at vstart. Use number to string

*/

error = iooutputs(SLOTO, cmd_buff, strlen(cmd_buff)); /*

conversion to send real numbers over the

*/

error_handler(error, cmd-buff);

/*

bus as part of the command string.

*/

cmd = "CURR .1”;

 

 

 

 

error = iooutputs(SLOT0, cmd, strlen(cmd));

 

 

 

 

error-handler(error, cmd);

 

 

 

 

cmd = “OUTPUT ON";

/*

Enable output */

 

 

104 Application Programs

Page 103
Image 103
Agilent Technologies 66lxxA manual Application #3 Controlling Voltage Ramp UP AT Turn on, Dwell = ramptime