AnsweredAssumed Answered

Power Meter HP436A, Help!!

Question asked by howe123 on Aug 10, 2010
Latest reply on Aug 16, 2010 by howe123
Hello everyone,  I got problem with reading power meter HP436A.  The attachment is my C# code, it can write to but can not read from meter.
Please help me!  Thank you very much.


////////////////////
using System;
using Ivi.Visa.Interop;
using System.Threading;

namespace readPmHP436A
{
    class Program
    {
        private static Ivi.Visa.Interop.FormattedIO488 ioPm;
        private static int adrPm = 12;

        static void InitializePm()
        {
                ioPm = new FormattedIO488Class();
                ResourceManager gr1 = new ResourceManager();
                ioPm.IO = (IMessage)gr1.Open("GPIB::" + adrPm.ToString(),
                                    AccessMode.NO_LOCK, 2000, " ");
                ioPm.IO.Timeout = 7000;
        }

        // Read Power, PmHP436A
        static string ReadPm()
        {
            string str;
            ioPm.WriteString("9D+V", true);
            Thread.Sleep(50);
            str = ioPm.ReadString();
            return str;
        }

        static void Main(string[] args)
        {
            InitializePm();
            Console.WriteLine("Pm initialized.");
            Console.WriteLine("Pm read: {0} dBm", ReadPm());
        }
    }
}  

Outcomes