Keysight E4428C ESG RF Programming Manual page 255

Signal generators
Table of Contents

Advertisement

Line
Code—Interleaving and Byte Swapping for Little Endian Order
20
char iqbuffer[NUMSAMPLES*4];
21
for(index=0; index<numsamples; index++)
22
{
23
short ivalue = idata[index];
24
short qvalue = qdata[index];
25
iqbuffer[index*4]
26
iqbuffer[index*4+1] = ivalue & 0xFF;
27
iqbuffer[index*4+2] = (qvalue >> 8) & 0xFF;
28
iqbuffer[index*4+3] = qvalue & 0xFF;
29
}
30
return 0;
Line
Code Description—Interleaving and Byte Swapping for Little Endian Order
20
Define a character array to store the interleaved I and Q data. The character array makes byte swapping
easier, since each array location accepts only 8 bits (1 byte). The array size increases by four times to
accommodate two bytes of I data and two bytes of Q data.
21–29
Create a loop to do the following:
Save the current I data array value to a variable.
NOTE
Save the current Q data array value to a variable.
Swap the low bytes (bits 0–7) of the data with the high bytes of the data (done for both
Keysight Signal Generators Programming Guide
= (ivalue >> 8) & 0xFF;
In rare instances, a compiler may define short as larger than 16 bits. If this condition exists,
replace short with the appropriate object or label that defines a 16–bit integer.
Creating and Downloading Waveform Files
Creating Waveform Data
247

Advertisement

Table of Contents
loading

Table of Contents