
Como curiosidad, estoy usando WPF C# 2013. Quiero usar el puerto serie RS232, en AWF tiene el componente serialPort1, mientras WPF no lo incluye. Quiero enviar tramas de bytes pulsando un botón.
En Visual C# 2013 AWF su código es así:
Código:
También en forma de cadena se hace así:private void button_t_Click(object sender, EventArgs e) { byte[] mBuffer = new byte[5]; mBuffer[0] = 0x74; mBuffer[1] = 0x75; mBuffer[2] = 0x89; mBuffer[3] = 0x20; mBuffer[4] = 0x6C; serialPort1.Write(mBuffer, 0, mBuffer.Length); }
Código:
Abrir puerto y cerrarlo.private void button_b_Click(object sender, EventArgs e) { byte[] mBuffer = Encoding.ASCII.GetBytes("Hello World"); serialPort1.Write(mBuffer, 0, mBuffer.Length); }
Código:
using System.IO.Ports;serialPort1.Open(); serialPort1.Close();
Sabiendo todo lo de arriba, cuya información aparece aquí.
¿Es posible hacer una aplicación con WPF?
Algún código de ejemplo?
Un cordial saludos.