Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA + C# + RS485 + carriage return

Hi, everybody!
I have an engine and I want to control it by means of rs485.

 

 wData = new SerialSession("COM7");
 wData.BaudRate = 9600;
 wData.TerminationCharacterEnabled = true;
 String Command = "AV10000"+"\r";
 byte[] bytes = new byte[8];
 int bWritten = ASCIIEncoding.ASCII.GetBytes(Command, 0,      Command.Length, bytes, 0);
 wData.Write(bytes);
 wData.Clear();

 through visa and c# there is no response

 Problem is "#0D" but I send it through "\r"

 

 

 

Through the terminal program everything works

 

Скриншот 2014-08-05 10.15.38.png

 

Скриншот 2014-08-05 10.15.55.png

 

Скриншот 2014-08-05 10.16.24.png

0 Kudos
Message 1 of 5
(5,527 Views)

@mell90 wrote:

Hi, everybody!
I have an engine and I want to control it by means of rs485.

 

 wData = new SerialSession("COM7");
 wData.BaudRate = 9600;
 wData.TerminationCharacterEnabled = true;
 String Command = "AV10000"+"\r";
 byte[] bytes = new byte[8];
 int bWritten = ASCIIEncoding.ASCII.GetBytes(Command, 0,      Command.Length, bytes, 0);
 wData.Write(bytes);
 wData.Clear();

 through visa and c# there is no response

 Problem is "#0D" but I send it through "\r"

 

 

If you know that you need to send #0D why are you deliberately sending \r  ?
0 Kudos
Message 2 of 5
(5,499 Views)

Because in this case it sends "#0D" as a string and the engine to it doesn't react

0 Kudos
Message 3 of 5
(5,497 Views)

@mell90 wrote:

Because in this case it sends "#0D" as a string and the engine to it doesn't react


And what does the engine documentation says needs to be sent?

0 Kudos
Message 4 of 5
(5,493 Views)

For example "AV10000" + "carriage return"

via the terminal on the second picture I send

 

via the serialport c# it works also goog but not with VISA

serialPort.Write("AV10000\r"); 

 

 

 

0 Kudos
Message 5 of 5
(5,485 Views)