Documente Academic
Documente Profesional
Documente Cultură
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
System.Windows.Forms;
System.Threading;
namespace winproyUART
{
public partial class Form1 : Form
{
Thread hebrita;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
hebrita = new Thread(enviando);
hebrita.Start();
}
private void enviando()
{
//Normalemente ira en button1_clik pero se pone en 'enviando' para poder usar
hebras
}
private void button2_Click(object sender, EventArgs e)
{
textBox2.Text = puerto.BytesToWrite.ToString();
//hebras: flujos de ejecusin : 0para instrucciones paralelas
}
}
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Threading.Tasks;
System.Windows.Forms;
namespace winProyUART2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnBytesRex_Click(object sender, EventArgs e)
{
txtBytesRex.Text = puerto.BytesToRead.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
puerto.Open();
puerto.BaudRate = 100;
//cuando lleguen 20 bytes se va a disparar el evento de recepcin
puerto.ReceivedBytesThreshold = 20;