Programa C# DSP
Programa C# DSP
Programa C# DSP
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];
public Main()
{
InitializeComponent();
try
{
serialPuerto.PortName = "COM10";
//serialPuerto.Open();
}
catch (Exception ex) { System.Console.WriteLine(ex.ToString()); };
}
}
private void button1_Click_1(object sender, EventArgs e)
{
double numdouble = Convert.ToDouble(this.textBox1.Text);
//Enviar caso
dataTX[0] = 2;
this.serialPuerto.Write(dataTX, 0, 1);
//Enviar los 2 bytes
dataTX[0] = (byte)numdouble;
this.serialPuerto.Write(dataTX, 0, 1);
dataTX[0] = (byte)((numdouble * 100) % 100);
this.serialPuerto.Write(dataTX, 0, 1);
}
}
}