3-12 Programming Examples
DS335 Synthesized Function Generator
EXAMPLE 1: GPIB COMMUNICATION. C LANGUAGE
This program communicates with the DS335 via GPIB . The program is written in C.
/*
C Program to demonstrate communication with the DS335 via
GPIB. Written in Microsoft C and uses National Instruments
GPIB card. Assumes DS335 is installed as device name DDS335.
Refer to National Instruments for Device Name setup.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dos.h>
#include <decl.h> /* National Instruments header files */
void main(void); /* function declaration */
int dds335;
void main()
{
char cmd[40];
char start[20];
char stop[20];
if ((dds335 = ibfind("DDS335")) < 0) /* open National driver */
{
printf ("Cannot find DDS335\n");
exit(1);
}
/* Now that the driver is located, reset the DS335 */
sprintf (cmd, "*RST\n");
ibwrt(dds335,cmd,strlen(cmd)); /* send command */
/* Setup the DS335 as follows:
500 kHz Square Wave, 1.5 Vpp, -1.0 Volt offset, display offset */
sprintf (cmd, "FREQ500000;AMPL1.5VP;OFFS-1.0;KEYS3;\n");
ibwrt(dds335,cmd,strlen(cmd)); /* send commands */
/* Now query the DS335 for the sweep start and stop frequencies */
sprintf (cmd, "STFR?\n"); /* ask for start rate */
ibwrt (dds335,cmd,strlen(cmd)); /* send query */
ibrd(dds335,start,20); /* read back start frequency */
sprintf (cmd, "SPFR?\n"); /* ask for stop rate */
ibwrt (dds335,cmd,strlen(cmd)); /* send query */
ibrd(dds335,stop,20); /* read back stop frequency */
printf("\n\n\n\n ******** DS335 Setup Demo *******" );
printf("\n\n\n\nDS335 Sweep Start Frequency = %e Hz\n\n", atof(start));
printf("DS335 Sweep Stop Frequency = %e Hz\n", atof(stop));
}
Summary of Contents for DS335
Page 2: ...DS335 Synthesized Function Generator...
Page 6: ...iv SRS Symbols DS335 Synthesized Function Generator...
Page 10: ...viii Specifications DS335 Synthesized Function Generator...
Page 18: ...2 4 Introduction DS335 Synthesized Function Generator...
Page 22: ...2 8 Features DS335 Synthesized Function Generator...
Page 26: ...2 12 Function Setting DS335 Synthesized Function Generator...
Page 30: ...2 16 Sweeps FSK DS335 Synthesized Function Generator...
Page 42: ...3 10 Programming Commands DS335 Synthesized Function Generator...
Page 46: ...3 14 Programming Examples DS335 Synthesized Function Generator...
Page 50: ...4 4 Troubleshooting DS335 Synthesized Function Generator...
Page 74: ...5 8 Circuitry DS335 Synthesized Function Generator...