User`s manual

":SOUR:VOLT:LEV:IMM:AMPL 5.1V", // Set the amplitude
"SOUR:LIST1:SEGM:SEL ramp", // Define the "ramp" segment name
"SOUR:LIST1:SEGM:DEF 100" // Define the segment size
},
*seg_commands = // Use "seg_commands" to store segments
"SOUR:LIST1:SEGM:VOLT", // Command to send volts data
*out_commands[] = // Use the "out_commands" array to generate output
{
"SOUR:LIST1:SSEQ:SEL ramp_out", // Define the sequence name as "ramp_out"
"SOUR:LIST1:SSEQ:DEF 1", // Define the sequence size
"SOUR:LIST1:SSEQ:SEQ ramp", // Set the segment execution order
"SOUR:FUNC:USER ramp_out", // Define the user name
"INIT:IMM" // Start waveform generation
};
float *Wave_seg;
int loop,
seg_size = 100; // Set the segment size to 100 points
char send_str[50];
// Allocate sufficient memory for storing the segments into computer memory
Wave_seg = (float*) malloc (seg_size * sizeof (float));
// Setup the AFG
cmd_exe(set_commands, sizeof(set_commands) / sizeof(char*), "gen_seg (set_commands)");
// Call routine to check for AFG errors
check_error("gen_seg (set_commands)");
// Calculate the segments
for (loop = 0; loop < seg_size; loop ++)
Wave_seg[loop] = (loop * .0505);
// Setup for iprintf function
sprintf(send_str, "%s %%,%if\n", seg_commands, seg_size);
// Call function to execute the final command with segment data
if(!iprintf(addr, send_str, Wave_seg))
time_out("gen_seg (seg_commands)");
// Call routine to check for AFG errors
check_error("gen_seg (seg_commands)");
// Setup the AFG for output
cmd_exe(out_commands, sizeof(out_commands) / sizeof(char*), "gen_seg (out_commands)");
Continued on Next Page
Chapter 1 Getting Started 43