BNC 645 User Manual

Page 176

Advertising
background image

176

status = viOpen(defaultRM,instrDesc, VI_NULL,VI_NULL, &vi);

if (status != VI_SUCCESS){

printf("Can

not

Open

device:\"%s\"\n",instrDesc);

return;

}

// This program uses low-level SCPI commands to configure

// the function gnerator to output an AM waveform.

// This program also shows how to use "state storage" to

// store the instrument configuration in memory.

viPrintf(vi,"*RST\n");

viPrintf(vi,"OUTPut:LOAD 50\n");

//Output termination is 50 Ohms

viPrintf(vi,"FUNCtion:SHAPe

SINusoid\n"); //Carrier

shape is sine

viPrintf(vi,"FREQuency

6000;VOLTage

3\n");//Carrier freq is 6 kHz @ 3 Vpp

viPrintf(vi,"AM:INTernal:FUNCtion SINusoid\n");//Modulating shape is sine

viPrintf(vi,"AM:INTernal:FREQuency

300\n"); //Modulation freq = 300 Hz

viPrintf(vi,"AM:DEPTh

90\n");

//Modulation depth = 90%

viPrintf(vi,"AM:STATe

ON\n");

//Turn AM modulation on

viPrintf(vi,"OUTPut

ON\n");

//Turn on the instrument output

viPrintf(vi,"*SAV

2\n");

//Store state in memory location 2

// Use the "*RCL 2" command to recall the stored state output

viClose

(vi);

viClose

(defaultRM);

}

Example: Linear Sweep

This program (found in the “Examples\Linear_Sweep” subdirectory on the CDROM)

creates a linear sweep for a sine wave. It sets the start and stop frequencies, and

the sweep time.

//Linear Sweep

#include <visa.h>

#include <stdio.h>

Advertising