showEventHandler aa;
public void show(string a)
{
TextBox1.Text = a;
Label1.Text = a;
}
private void ReadPort(Object sender, SerialDataReceivedEventArgs e)
{
Thread.Sleep(500);
if (spReceive.IsOpen)
{
byte[] readBuffer = new byte[4];
try
{
spReceive.Read(readBuffer, 0, 4);
string s100 = ByteArrayToHexString(readBuffer);
aa = new UpdateTextEventHandler(show);
aa(s100);
ReadInto(s100);
}
catch (TimeoutException) { }
}
else
{
TimeSpan waitTime = new TimeSpan(0, 0, 0, 0, 50);
Thread.Sleep(waitTime);
}
}
asp.net 基于c#从SerialPort中读取数据,为什么显示不到页面上面,但可以...
http:\/\/www.devasp.net\/net\/articles\/display\/727.html