Beruflich Dokumente
Kultur Dokumente
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.IO.Ports;
namespace SerialTest
{
public partial class Form1 : Form
{
public int RB0=0;
int RB1;
int RB2;
int RB3;
int RB4;
int RB5;
int RB6;
int RB7;
int time = 0;
public Form1()
{
InitializeComponent();
}
// Console.WriteLine("Incoming Data:");
// Begin communications
port.Open();
}
// Begin communications
port.Open();
// port.DiscardOutBuffer();
}
last = data.Last();
AppendTextBox(data);
if (last.ToString()=="u")
{
AppendTextBox(Environment.NewLine);
}
//port.DiscardOutBuffer();
}
port.Write(textBox2.Text+"*");
// port.Write("*");
// port.DiscardInBuffer();
}
public void AppendTextBox(string value)
{
if (InvokeRequired)
{
this.Invoke(new Action<string>(AppendTextBox), new object[] { value
});
return;
}
textBox1.Text += value;
if (RB0 == 0)
{
port.Write("rbnn*");
}
RB0 = 1;
__delay_ms(10);
RB0 = 0;
// __delay_ms(1000);
Delay.Enabled = true;
LOOP:
if (msc!=TimerValue)
{
goto LOOP;
}
Delay.Enabled = false;