日期:2014-05-17 浏览次数:20810 次
private void aTimer_Elapsed(object sender, ElapsedEventArgs s)
{
if (isOpen)
{
try
{
//SetPortProperty();
//ScreenBox.Text += sp.ReadExisting();
//string overWord="over";
//sp.NewLine = overWord;
//ScreenBox.Text += sp.ReadLine();
ChangeText CText = delegate()//声明和定义一个匿名代理
{
// ScreenBox.Text += sp.ReadExisting();
string dataRev;
byte[] byteRead=new byte[serialPort1.BytesToRead;
sp.Read(byteRead, 0, byteRead.Length);
dataRev = Encoding.Default.GetString(byteRead);
ScreenBox.Text += dataRev;