16
STX8081 / Re:Comunicación c# - Siemens Simatic HMI EsRecipeView
« : abril 12, 2015, 20:34:07 pm »
Gracias, lo voy a intentar:
Esta sección te permite ver todos los mensajes hechos por este usuario, recuerda que solo puedes ver los mensajes en áreas en donde tu tienes acceso.
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using stx8xxx;
namespace Prueba1
{
public partial class Form1 : Form
{
Stx8xxx PioBoard;
public Form1()
{
InitializeComponent();
// Inicializar objeto PioBoard.
PioBoard = new Stx8xxx("192.168.1.81", 0, Stx8xxxId.STX8081);
}
private void button1_Click(object sender, EventArgs e)
{
// Variable para retorno de estado del PLC.
UdpRxCmdStat OnUdpRxStat = UdpRxCmdStat.OK;
// Crear array de bytes a enviar (dos bytes).
byte[] DataBytes = new byte[2];
// Especificar el primer byte el valor "1", para activar RELAY1 / DOUT1.
DataBytes[0] = (byte)1;
// Especificar el segundo byte un valor cualquiera.
DataBytes[1] = (byte)55;
// Enviar bytes UDP al script con el metodo "Send".
PioBoard.Cmd.Udp.Send(DataBytes, 2, out OnUdpRxStat);
}
private void button2_Click(object sender, EventArgs e)
{
// Variable para retorno de estado del PLC.
UdpRxCmdStat OnUdpRxStat = UdpRxCmdStat.OK;
// Crear array de bytes a enviar (dos bytes).
byte[] DataBytes = new byte[2];
// Especificar el primer byte el valor "0", para desactivar RELAY1 / DOUT1
DataBytes[0] = (byte)0;
// Especificar el segundo byte un valor cualquiera.
DataBytes[1] = (byte)66;
// Enviar bytes UDP al script con el metodo "Send".
PioBoard.Cmd.Udp.Send(DataBytes, 2, out OnUdpRxStat);
}
private void tortasBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.tortasBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.panaderíaDataSet1);
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: esta línea de código carga datos en la tabla 'panaderíaDataSet1.tortas' Puede moverla o quitarla según sea necesario.
this.tortasTableAdapter.Fill(this.panaderíaDataSet1.tortas);
}
}
}