コード例 #1
0
        /// <summary>
        /// Toolstrip Click Event for Digital IO funcion settings: Input & Output functions
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (_wtxDevice != null)
            {
                _wtxDevice.Stop();

                if (_wtxDevice.Connection.ConnectionType == ConnectionType.Modbus)
                {
                    _wtxDevice.Disconnect();

                    JetBusConnection _connection = new JetBusConnection(_ipAddress);
                    _wtxDevice = new WTXJet(_connection, 500, update);

                    _wtxDevice.Connect(5000);

                    _functionIOForm = new FunctionIO();

                    _functionIOForm.ReadButtonClicked_IOFunctions  += ReadDigitalIOFunctions;
                    _functionIOForm.WriteButtonClicked_IOFunctions += WriteDigitalIOFunctions;

                    DialogResult res = _functionIOForm.ShowDialog();
                }
                else
                if (_wtxDevice.Connection.ConnectionType == ConnectionType.Jetbus)
                {
                    _functionIOForm = new FunctionIO();

                    _functionIOForm.ReadButtonClicked_IOFunctions  += ReadDigitalIOFunctions;
                    _functionIOForm.WriteButtonClicked_IOFunctions += WriteDigitalIOFunctions;

                    DialogResult res = _functionIOForm.ShowDialog();
                }
                _wtxDevice.Restart();
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: leistner/Automation-API
        /*
         * This method does a calibration with an individual weight to the WTX.
         * First you tip the value for the calibration weight, then you set the value for the dead load (method ‚MeasureZero‘),
         * finally you set the value for the nominal weight in the WTX (method ‚Calibrate(calibrationValue)‘).
         */
        private static void CalibrationWithWeight()
        {
            _wtxDevice.Stop();

            Console.Clear();
            Console.WriteLine("\nPlease tip the value for the calibration weight and tip enter to confirm : ");
            _calibrationWeight = Console.ReadLine();

            Console.WriteLine("\nTo start : Set zero load and press any key for measuring zero and wait.");
            string another = Console.ReadLine();

            _wtxDevice.AdjustZeroSignal();
            Console.WriteLine("\nZero load measured.Put weight on scale, press any key and wait.");

            string another2 = Console.ReadLine();

            _wtxDevice.AdjustNominalSignalWithCalibrationWeight(CalibrationWeight());

            _wtxDevice.Restart();
        }