AnsweredAssumed Answered

E5071C Data Transfer Over LAN

Question asked by ceken on Jul 19, 2010
Latest reply on Jul 20, 2010 by odanzy
Dear All,
I try to transfer s12 REAL32 formatted data from E5071C over LAN. I Have written following code for controlling one single sweep of Network Analyzer. It works for the first time but when i try to transfer one more it gives a Format Exception. Here are my codes. Any Help would be appreciated.
By the Way it works well using GPIB bus.

Regards
Cengiz EKEN,Sr

public void singleSweepOpc(sbyte channel)
        {
            //Here we clear the status byte, then enable the status register to receive the OPC (operation complete).  We take a single sweep
           // Then send the OPC command and
            // start waiting.
            int esr=0;
   
            writeLine("*CLS;*ESE 1");
            writeLine("TRIG:SOUR BUS");
            writeLine("init" + channel + ":cont on");
            writeLine(":TRIG:SING");
            writeLine("*OPC");
            while (true)
            {
                for (int i = 0; i < 700; i++)
                {
                    Thread.Sleep(60);
                    writeLine("*STB?");
                    Thread.Sleep(260);
                    esr = readInt();
                   
                    if ((esr & 32) == 32)
                    {
                        esr=1;
                        break;
                    }
                }
                if (esr == 1)
                    break;
                else
                MessageBox.Show("Error in communication");
           }
        }


private int readInt()
        {
            byte&#91;&#93; data = new byte&#91;1024&#93;;
            int receivedDataLength = Soket.Receive(data);
            return Convert.ToInt32(Encoding.ASCII.GetString(data, 0, 4));
        }



Sample value for data variable is [0x2b,0x30,0x0a,0x2b,0x30,0x0a]. This is the value after the second attemp to read data from E5071C. So İt gives An Exception  

Outcomes