Agilent Technologies E8663B Portable Generator User Manual


 
254 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Creating and Downloading Waveform Files
Programming Examples
// The SCPI command has four parts.
// Part 1 = :MEM:DATA “filename”,
// Part 2 = length of Part 3 when written to a string
// Part 3 = length of the data in bytes. This is in s from above.
// Part 4 = the buffer of data
// Build parts 1, 2, and 3 for the I data.
sprintf(cmd, “:MEM:DATA \”ARBI:FILE1\”, #%d%d”, strlen(s), bytesToSend);
// Send parts 1, 2, and 3
iwrite(id, cmd, strlen(cmd), 0, 0);
// Send part 4. Be careful to use the correct command here. In many
// programming languages, there are two methods to send SCPI commands:
// Method 1 = stop at the first ‘0’ in the data
// Method 2 = send a fixed number of bytes, ignoring ‘0’ in the data.
// You must find and use the correct command for Method 2.
iwrite(id, ibuffer, bytesToSend, 0, 0);
// Send a terminating carriage return
iwrite(id, “\n”, 1, 1, 0);
// Identical to the section above, except for the Q data.
sprintf(cmd, “:MEM:DATA \”ARBQ:FILE1\”, #%d%d”, strlen(s),bytesToSend);
iwrite(id, cmd, strlen(cmd), 0, 0);
iwrite(id, qbuffer, bytesToSend, 0, 0);
iwrite(id, “\n”, 1, 1, 0);
printf(“Loaded FILE1 using the E443xB format\n”);
// The E4438C, E8267C and E8267D have a newer faster format which
// allows 16 bits to be used. However this format is not accepted in
// the E443xB. Therefore do not use this next section for the E443xB.
printf(“Note: Loading FILE2 on a E443xB will cause \”ERROR: 208, I/O error\”\n”);
// Identical to the I and Q sections above except
// a) The I and Q data are interleaved
// b) The buffer of I+Q is twice as long as the I buffer was.
// c) The SCPI command uses WFM1 instead of ARBI and ARBQ.
bytesToSend = numsamples*4;
sprintf(s, “%d”, bytesToSend);
sprintf(cmd, “:mem:data \”WFM1:FILE2\”, #%d%d”, strlen(s),bytesToSend);
iwrite(id, cmd, strlen(cmd), 0, 0);