AnsweredAssumed Answered

"Expected command header" error when using C#

Question asked by scottym on Sep 24, 2019

Hello!

I'm new to the forums and to programming digital multimeters so please be patient.

I am trying to write C# code that will remotely interact with a 3458A DMM.  When I call the command: "ID?", I occasionally get back the following error:

SYNTAX -- *   Expected command header

This behavior is not consistent so I haven't found anything that seems to set it off.  If I try running again, it seems to work, but there's no guarantee it will keep running.

  • I have tried appending a CRLF to the command before I send it (so the command I send is literally:
    ID?\r\n
  • I've tried appending a semi-colon to the command:
    ID?;
  • I tried sending the END command prior to calling ID:
    END ALWAYS
  • When I enter the command into the VISA Interactive Control, I never get an error.
  • If I run the code, break right after the error, I can enter the ERRSTR? command into the VISA Interactive Control and also see the exception that way
    103,"SYNTAX\s--\s*\s\s\sExpected\scommand\sheader."\r\n

Does anyone have any suggestions as to how to send this command (and any other, but for now I just need to get this one working) using C# so that it doesn't throw that exception?

 

Thanks in advance,

Scott

Outcomes