Home > Net >  SerialPort method DataReceived event is not triggered
SerialPort method DataReceived event is not triggered

Time:09-25

Private void btnOpen_Click (object sender, EventArgs e)
{
SerialPort. PortName=cmbPort. Text;
SerialPort. BaudRate=the Convert. ToInt32 (cmbBaud. Text, 10);
SerialPort. DataBits=8;
SerialPort. Parity=0 (Parity);
SerialPort. StopBits=StopBits. One;
SerialPort. RtsEnable=true;
SerialPort. ReceivedBytesThreshold=1;
SerialPort. DtrEnable=true;
SerialPort. The Open ();
SerialPort. Method DataReceived +=new SerialDataReceivedEventHandler (post_DataReceived);
}


Opening a serial port, good to should be the value of the object are assigned, from the Internet to check the solution, but the event does not trigger, under the guidance of the great god, please.

CodePudding user response:

There are data to receive?

CodePudding user response:

Do you mean special one place to receive the data? Yes,

CodePudding user response:

No, it's port if there is any data transfer

CodePudding user response:

Do you mean on the port of wiring or equipment?

CodePudding user response:

You see if there are any results returned in polling mode

CodePudding user response:

Don't know what the polling concept

CodePudding user response:

Should serialPort=new serialPort (cmbPort. Text)?

CodePudding user response:

But alas, were doing this, I am not a serial port, USB, then a pile of data,,,,

CodePudding user response:

If the open Com1, Com1 data receiving, will connect automatically, as for breakpoints not into, it is because you opened the wrong serial port, is another really accept, check the name of the Com is that, I see more than one? Hard coding, with com, has seen a a try,

CodePudding user response:

Code no problem.. If the event to trigger said serial no uplink data for you.

In addition, no possible.

What is your serial mechanism? Take the initiative to upload or all of the way?

You try the serial debugging assistant, first, to receive the data in writing code parsing.
  •  Tags:  
  • C #
  • Related