BNC 645 User Manual

Page 177

Advertising
background image

177

void main (int argc,char *argv[])

{

ViSession

defaultRM,vi=0;

ViStatus

status;

char

instrDesc[]="USB0::5710::4002::TW00009009::0::INSTR";

viOpenDefaultRM

(&defaultRM);

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

if (status != VI_SUCCESS){

printf("Can

not

Open

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

return;

}

//This program sets up a linear sweep using a sinusoid

//waveform. It sets the start and stop frequency and sweep

//time.

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

viPrintf(vi,"FUNCtion

SINusoid\n");

//Select

waveshape

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

//Set the load impedance to

// 50 Ohms (default)

viPrintf(vi,"VOLTage

1\n");

//Set

the

amplitude

to

1

Vpp.

viPrintf(vi,"SWEep:SPACing

LINear\n"); //Set Linear or LOG spacing

viPrintf(vi,"SWEep:TIME

1\n");

//Sweep time is 1 second

viPrintf(vi,"FREQuency:STARt

100\n"); //Start frequency is 100 Hz

viPrintf(vi,"FREQuency:STOP

20e3\n"); //Stop frequency is 20 kHz

//Frequency sweep limits may also be set as FREQuency:CENTer and

viPrintf(vi,"OUTPut

ON\n");

//Turn on the instrument output

viPrintf(vi,"SWEep:STATe

ON\n");

//Turn sweep on

viClose

(vi);

viClose

(defaultRM);

}

Example: A Pulse Waveform

This program (found in the “Examples\Pulse” subdirectory on the CD-ROM)

configures a pulse waveform, setting pulse width, period, and high/low levels. The

Advertising