#include <visa.h>
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
ViStatus errorStatus = 0;
ViSession viRm = 0, vi = 0;
/* Open session to GPIB device at address 10 */
errorStatus = viOpenDefaultRM(&viRm);
errorStatus = viOpen(viRm, "GPIB0::10::INSTR",
VI_NULL, 10000, &vi);
double pi, temp_waveform, n_cycles, damp_factor, data_size;
short waveform[16000];
long i;
char cmd_str[50];
// Setup the waveform
pi = 3.14159; // The approximate value of PI
n_cycles = 16; // Toyal number of cycles
damp_factor = -5; // Damping factor
data_size = 16000;
// Generate the waveform
for (i=1; i <= ((long)data_size); i++)
{
temp_waveform = sin(2*pi*n_cycles*(i)/data_size)*8191;
waveform[i-1] = (short)(temp_waveform *
exp(damp_factor*i/data_size));
}
// Set byte order for binary block data transfer;
// order depends on computer and GPIB card used;
// NORMal = most significant bit (MSB) sent first,
// SWAPped = least significant bit (LSB) sent first
viPrintf(vi, "FORMat:BORDer NORMal\n");
// Setup cmd_str for the viPrintf function to send block data
// cmd_str should look like this:
// "DATA:DAC VOLATILE,%16000hb\n"