scottel21 (Customer) asked a question.

How do I read data back from the STP-MTRD 23042RE device?

I am writing a C# application to control the STP-MTRD 23042RE device. Everything going to the device is working great, but I cannot seem to read data from the device. Can someone help me get this going? Here are some code snippets I'm working with.

 

1. Opening the port:

Port = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);

Port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);

Port.Open();

 

2. Sending the IP command

public static string IPcommand = "IP";

Command = Encoding.ASCII.GetBytes(IPCommand);

Command = AddCRtoByteArray(Command);

Port.Write(Command, 0, Command.Length);

 

3. Receive data from device

private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)

{

// Show all the incoming data in the port's buffer

string text = Port.ReadExisting();

trace(text);

}

 

All commands (such as CJ and SJ) are working, but my callback is never called.

 

Any guidance on what I need to change would be extremely appreciated! Thank you.