コード例 #1
0
        private void EntryDeviceStatus()
        {
            int    iReturnCode;                           //Return code
            String szDeviceName  = "M1001\nM1001\nM1002"; //List data for 'DeviceName'
            int    iNumberOfData = 3;                     //Data for 'DeviceSize'
            int    iMonitorCycle = 1;                     //Data for 'MonitorCycle'

            int[] arrDeviceValue;                         //Data for 'DeviceValue'

            //Check the 'DeviceValue'.(If succeeded, the value is gotten.)
            arrDeviceValue    = new int[iNumberOfData];
            arrDeviceValue[0] = 1;
            arrDeviceValue[1] = 0;
            arrDeviceValue[2] = 1;

            //
            //Processing of EntryDeviceStatus method
            //
            try
            {
                ///The EntryDeviceStatus method is executed.
                iReturnCode = plc.EntryDeviceStatus(szDeviceName,
                                                    iNumberOfData,
                                                    iMonitorCycle,
                                                    ref arrDeviceValue[0]);
            }
            //Exception processing
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                return;
            }

            //The return code of the method is displayed by the hexadecimal.
            //txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode);
            string stringFormat = string.Format("{0}:{1:x8}:{2}\n", "EntryDeviceStatus", iReturnCode, "");

            //Form_menu.StatusPLCLog(stringFormat);
            StatusPLCLog = stringFormat;
        }