User`s guide

96
Programming Your Instruments
Example Programs
/* Swap data bytes (send LSB first) */
CHECK(ag33250a_freq(vi, 5000));
/* Output frequency is 5 kHz */
CHECK(ag33250a_outpLoad(vi, ag33250a_OUTPUT_LOAD_50));
/* Output termination is 50 Ohms */
CHECK(ag33250a_volt(vi, 5));
/* Output amplitude is 5 Vpp */
fprintf(stderr, "Computing Waveform...\n");
/* Calculate data points */
for (i = 1; i<= 16000; i++)
{
if(i < 14000)
{
Waveform[i-1] = (short)(sin(2.0 * pi * (double)Ncycles *
(double)i / 14000) * 2047
* exp(Damp_factor * (double)i / 14000) + 0.5);
}
else
{
Waveform[i-1] = 0;
}
/* Download data points to volatile memory from array */
fprintf(stderr, "Downloading Arb...\n");
CHECK(ag33250a_dataDacVolatile(vi, 16000, Waveform));
CHECK(ag33250a_opc_Q(vi, &reply));
fprintf(stderr, "Download Complete\n");
CHECK(ag33250a_dataCopy(vi, "DAMP_SIN"));
/* Copy arb to non-volatile memory */
CHECK(ag33250a_funcUserName(vi, "DAMP_SIN"));
/* Select the active arb waveform */
CHECK(ag33250a_funcShap(vi, ag33250a_OUTPUT_FUNC_USER));
/* Output the selected arb waveform */
CHECK(ag33250a_outpSetup(vi, ag33250a_OUTPUT_SETUP_ON));
/* Enable output */
CHECK(ag33250a_close(vi));
}