AnsweredAssumed Answered

E4438C Waveform Download using C

Question asked by ceken on Aug 23, 2010
Latest reply on Aug 24, 2010 by ceken
Hi All,
I have been trying to download IQ data to E4438C over LAN but I got "-103, Invalid Seperator" Eror. I could not locate the soruce of error in my code. Any help would be appreciated. I attached my code.
Regards
Cengiz EKEN

StreamWriter sr = new StreamWriter(Directory.GetCurrentDirectory() + "/IQData.txt");
            const int NUMSAMPLES = 500;
            byte[] iqBuffer = new byte[NUMSAMPLES * 4];
            short[] idata = new short[NUMSAMPLES];
            short[] qdata = new short[NUMSAMPLES];
            short ivalue;
            short qvalue;

            int numsamples = NUMSAMPLES;
            for (int index = 0; index < numsamples; index++)
            {
                idata&#91;index&#93; = (short)(23000 * Math.Sin((2 * 3.14 * index) / numsamples));
                qdata&#91;index&#93; = (short)(23000 * Math.Cos((2 * 3.14 * index) / numsamples));
            }


            for (int index = 0; index < numsamples; index++)
            {
                sr.Write(idata&#91;index&#93; + " ");
                sr.WriteLine(qdata&#91;index&#93;);
                sr.Flush();
            }
            sr.Close();

            for (int index = 0; index < numsamples; index++)
            {
                ivalue = idata&#91;index&#93;;
                qvalue = qdata&#91;index&#93;;
                iqBuffer&#91;index * 4&#93; = (byte)((ivalue >> 8) & 0xFF);
                iqBuffer&#91;index * 4 + 1&#93; = (byte)(ivalue & 0xFF);
                iqBuffer&#91;index * 4 + 2&#93; = (byte)((qvalue >> 8) & 0xFF);
                iqBuffer&#91;index * 4 + 3&#93; = (byte)(qvalue & 0xFF);
            }
           
           String iqBufferStr = System.Text.Encoding.UTF8.GetString(iqBuffer);
           
            writeLine(":MEM:DATA:UNPR \'WFM1:myDataDosya\' #" + iqBuffer.Length.ToString().Length + iqBuffer.Length + " " + iqBufferStr);

PS:I got this example E4400-90627.pdf "Agilent Technologies Signal Generators Creating And Downloading  Waveform Files for c++ and converted to c#  

Outcomes