Click here to Skip to main content
15,905,229 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I trying to get measurement From the Power Supply Agilent E3634 but I become this error (-440 Query UNTERMINATED after indefinite response)

What I have tried:

this is my Code:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Management;
using System.IO.Ports;
using System.IO;

namespace ConsoleApplication1
{
    class PortDataReceived
    {
        public static void Main()
        {
            SerialPort mySerialPort = new SerialPort("COM1");
            mySerialPort.BaudRate = 9600;
            mySerialPort.Parity = Parity.None;
            mySerialPort.StopBits = StopBits.Two;
            mySerialPort.DataBits = 8;
            mySerialPort.Handshake = Handshake.None;
            mySerialPort.RtsEnable = true;
            mySerialPort.ReadTimeout = 1000;

            mySerialPort.Open();

            mySerialPort.WriteLine("MEAS:VOLT?");
            Thread.Sleep(750);

            string voltagevalue = mySerialPort.ReadExisting();
            Console.WriteLine(voltagevalue);

            mySerialPort.Close();
        }
    }
}
Posted
Updated 25-Sep-17 22:34pm
v2

1 solution

At a guess - and that's all it can be without access to the hardware - the error message is saying that you didn't terminate the query properly, possibly with a new line or similar?

Don't leap into code: there are too many potential problem sources. Instead, start with something like HyperTerminal and establish reliable communications first: type your command "MEAS:VOLT?" into HT and look at what comes back. When you have reliable communications (and the manual for the device will help here) then you can start automating the process via code: but until you know exactly what works to start with, you are running up against too many unknowns to get anywhere in a reasonable time frame. And most communications descriptions in manuals are far too open to interpretation (or just plain miss stuff out).

I'd also look at the manufacturer's website and see if any sample code is available - that could be a good starting point because it should work "right out of the box".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900