예제 #1
0
        public HZZHCtrllerAPIHandle()
        {
            _syncObj                  = new object();
            _comNet                   = new Modbus.Common();
            _netWorkState             = false;
            _netConnected             = false;
            BaseDataCapacityForModbus = 10;
            _netQueue                 = new System.Collections.Concurrent.ConcurrentQueue <ProDriver.Auxiliary.HZZHComBaseData>();

            //轴位置:从指定地址开始的,30个整型变量
            AxesPositionBaseData = new ProDriver.Auxiliary.HZZHComBaseData();
            AxesPositionBaseData.AssignValue <int>((ushort)ProDriver.Auxiliary.HZZHCtrllerAddress.AxisPosition, 30);

            //轴状态:从指定地址开始的,5个整型变量
            AxesStatusBaseData = new ProDriver.Auxiliary.HZZHComBaseData();
            AxesStatusBaseData.AssignValue <int>((ushort)ProDriver.Auxiliary.HZZHCtrllerAddress.AxisStatus, 5);

            //输入端口状态:从指定地址开始的,40个整型变量
            InputStatusBaseData = new ProDriver.Auxiliary.HZZHComBaseData();
            InputStatusBaseData.AssignValue <int>((ushort)ProDriver.Auxiliary.HZZHCtrllerAddress.InputStatus, 40);

            //输出端口状态:从指定地址开始的,40个整型变量
            OutputStatusBaseData = new ProDriver.Auxiliary.HZZHComBaseData();
            OutputStatusBaseData.AssignValue <int>((ushort)ProDriver.Auxiliary.HZZHCtrllerAddress.OutputStatus, 40);

            //错误代码:从指定地址开始的,20个整型变量
            ErrorCodeBaseData = new ProDriver.Auxiliary.HZZHComBaseData();
            ErrorCodeBaseData.AssignValue <int>((ushort)ProDriver.Auxiliary.HZZHCtrllerAddress.ErrorCode, 20);

            //报警状态:从指定地址开始的,1个整型变量
            ErrorLevelBaseData = new ProDriver.Auxiliary.HZZHComBaseData();
            ErrorLevelBaseData.AssignValue <int>((ushort)ProDriver.Auxiliary.HZZHCtrllerAddress.ErrorLevel, 1);

            //板卡运行状态:从指定地址开始的,1个整型变量
            MachineStatusBaseData = new ProDriver.Auxiliary.HZZHComBaseData();
            MachineStatusBaseData.AssignValue <int>((ushort)ProDriver.Auxiliary.HZZHCtrllerAddress.RunStatus, 1);
        }