Stanford Research Systems DS360 Operating Manual And Programming Reference page 82

Ultra low distortion function generator
Table of Contents

Advertisement

4-24 Remote Programming
Example1: GPIB Communication in C language
/*
C program to demonstrate communication with the DS360 via GPIB.
Written in Microsoft C and uses National Instruments GPIB card.
Assumes DS360 is installed as device name DS360.
Refer to National Instruments for Device Name setup.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <decl.h>
void main(void);
int ds360;
void main()
{
char cmd[40];
char start[20];
char stop[20];
if ((ds360 = ibfind("DS360")) < 0)
{
printf ("Cannot find DS360\n");
exit(1);
}
/* Now that the driver is located, reset the DS360 */
sprintf (cmd,"*RST\n");
ibwrt(ds360,cmd,strlen(cmd));
/* Setup the DS360 as follows:
50kHz,square wave,1.5Vpp, -1.0Volt offset,display offset */
sprintf (cmd, "FREQ50000";FUNC1;AMPL1.5VP;OFFS-1.5;KEYS8\n");
ibwrt(ds360,cmd,strlen(cmd)_;
/* Now, query the DS360 for the sweep start and stop frequencies */
sprintf(cmd, "STFR?\n");
ibwrt(ds360,cmd,strlen(cm));
ibrd(ds360,start,20);
sprintf(cmd, "SPFR?\n");
ibwrt(ds360,cmd,strlen(cm));
ibrd(ds360,stop,20);
printf("\n\n\n\n
printf("\n\nDS360 Sweep Start Frequency = %eHz\n\n",atof(start));
printf("\n\nDS360 Sweep Stop Frequency = %eHz\n\n",atof(stop));
}
DS360 Ultra Low Distortion Function Generator
/* National Instruments header files */
/* read back start freq*/
**** DS360 Setup Demo ****");
/* open National driver */
/* send command */
/* send command
*/
/* ask for start freq */
/* send query
/* read back start freq*/
/* ask for stop freq */
/* send query
*/
*/

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents