and this is the c# program
using System;
using System.Collections;//.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
namespace graphic1
{
public partial class Form1 : Form
{ SerialPort sp = new SerialPort();
int i,j;
string str;
public Form1()
{ InitializeComponent();
sp.PortName = "com1";
sp.BaudRate = 115200; // 9600;
sp.DataBits = 8;
sp.Parity = Parity.None;
sp.StopBits = StopBits.One;
sp.Handshake = Handshake.None;
sp.ReadTimeout = 15000;
sp.WriteTimeout = 15000;
sp.DataReceived += serialPort_DataReceived;
sp.Open();
}
//
void serialPort_DataReceived(object s, SerialDataReceivedEventArgs e)
{
byte[] data = new byte[sp.BytesToRead];
sp.Read(data, 0, data.Length);
//MessageBox.Show(data.ToString());
str=ByteArrayToString2(data);
MessageBox.Show(str);
}
}
}