//////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////// static void Main(string[] args) { if (Open() == true) { StringBuilder sb = new StringBuilder(200); // Buffer to get back slave parameters // Assume two slave devices for (uint i = 1; i < 3; i++) { // We can get some information ... for nothing, just to show SoemInterrop.GetDeviceInfo(i, DeviceInfoParam.OutputSize, sb); SoemInterrop.GetDeviceInfo(i, DeviceInfoParam.InputSize, sb); SoemInterrop.GetDeviceInfo(i, DeviceInfoParam.Config_Address, sb); Console.WriteLine("Slave @ : ", sb.ToString()); } // Assume two devices, copy two bytes from the input into the other output // echange buffers with the SOEM stack byte[] bin1 = new byte[50]; // must be equal or more than InputSize in the corresponding slave byte[] bout2 = new byte[50]; // must be strikcly equal to OutputSize in the corresponding slave for (; ;) { // Get Input from the first slave SoemInterrop.GetInput(1, bin1); // Some action ! bout2[0] = bin1[0]; bout2[1] = bin1[1]; // Set Output in the second slave SoemInterrop.SetOutput(2, bout2); // Quite tired with this work Thread.Sleep(200); } } }
public void ReadInput() { SoemInterrop.GetInput(Id, InputData); }