BNC 645 User Manual

Page 174

Advertising
background image

174

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

If the communication is via GPIB or LAN interface, you have to revise the following

USB command 1). to be GPIB 2). or LAN 3). one.

1). char instrDesc[]="USB0::5710::4002::TW00009009::INSTR";

2). char instrDesc[]="GPIB0::10:: INSTR"; //GPIB control,Address:10

3). char instrDesc[]="TCPIP0::192.168.0.123::inst0::INSTR";//IP

address:192.168.0.123

Program Listings

Example: A Simple Sine Waveform

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

selects the function as “sine,” and then sets the frequency, amplitude and offset of

the waveform.

//A Simple Sine Waveform

#include <visa.h>

#include <stdio.h>

#include <ctype.h>

#include <dos.h>

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

{

ViSession

defaultRM,vi=0;

ViStatus

status;

char

instrDesc[]="USB0::5710::4002::TW00009009::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 waveform by selecting the waveshape

//and adjusting the frequency, amplitude, and offset.

Advertising