Académique Documents
Professionnel Documents
Culture Documents
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
namespace Serial28335
{
public partial class Main : Form
{
byte[] dataTX = new byte[1024];
byte[] dataRX = new byte[1024];
int RxBytes=0;
string RxString;
int TxBytes = 0;
string TxString;
public Main()
{
InitializeComponent();
try
{
serialPuerto.PortName = "COM11";
//serialPuerto.Open();
}
catch (Exception ex) { System.Console.WriteLine(ex.ToString()); };
}
RxBytes += s.Length;
RxString = RxString + s;
this.RXContador.Text = RxBytes.ToString();
this.textBoxRX.Text = AtoX(RxString);
return;
}
/// <summary>
/// Updates the TX byte data info.
/// </summary>
private void TxDataUpdate(string s)
{
TxBytes += s.Length;
TxString = TxString + s;
this.TXContador.Text = TxBytes.ToString();
this.textBoxTX.Text += this.AtoX(s);
return;
}
/// <summary>
/// Updates the TX byte byte data info.
/// </summary>
private void TxDataUpdateBin(byte[] bb)
{
string s = "";
// Add padding.
int nSpaces = 62 - hex.Length;
for (int i = 0; i < nSpaces; i++)
hex += " ";
-5-