private void timerRefresh_Tick(object sender, EventArgs e)
        {
            if (!ControllerPlanetCNC.IsConnectedToController)
            {
                return;
            }

            //DEBUG:
            SuperByte bb14 = new SuperByte(ControllerPlanetCNC.Info.RawData[14]);

            checkBoxB0.Checked = bb14.Bit0;
            checkBoxB1.Checked = bb14.Bit1;
            checkBoxB2.Checked = bb14.Bit2;
            checkBoxB3.Checked = bb14.Bit3;
            checkBoxB4.Checked = bb14.Bit4;
            checkBoxB5.Checked = bb14.Bit5;
            checkBoxB6.Checked = bb14.Bit6;
            checkBoxB7.Checked = bb14.Bit7;


            SuperByte bb15 = new SuperByte(ControllerPlanetCNC.Info.RawData[15]);

            checkBox9.Checked = bb15.Bit7;
            checkBox8.Checked = bb15.Bit6;
            checkBox7.Checked = bb15.Bit5;
            checkBox6.Checked = bb15.Bit4;
            checkBox5.Checked = bb15.Bit3;
            checkBox4.Checked = bb15.Bit2;
            checkBox3.Checked = bb15.Bit1;
            checkBox2.Checked = bb15.Bit0;


            SuperByte bb19 = new SuperByte(ControllerPlanetCNC.Info.RawData[19]);

            checkBox10.Checked = bb19.Bit0;
            checkBox11.Checked = bb19.Bit1;
            checkBox12.Checked = bb19.Bit2;
            checkBox13.Checked = bb19.Bit3;
            checkBox14.Checked = bb19.Bit4;
            checkBox15.Checked = bb19.Bit5;
            checkBox16.Checked = bb19.Bit6;
            checkBox17.Checked = bb19.Bit7;


            label_FreeSizeBuffer.Text = ControllerPlanetCNC.Info.FreebuffSize.ToString();

            // end debug
        }
        private void timerRefresh_Tick(object sender, EventArgs e)
        {
            if (!Controller.Connected) return;

            //DEBUG:
            SuperByte bb14 = new SuperByte(Controller.INFO.rawData[14]);

            checkBoxB0.Checked = bb14.Bit0;
            checkBoxB1.Checked = bb14.Bit1;
            checkBoxB2.Checked = bb14.Bit2;
            checkBoxB3.Checked = bb14.Bit3;
            checkBoxB4.Checked = bb14.Bit4;
            checkBoxB5.Checked = bb14.Bit5;
            checkBoxB6.Checked = bb14.Bit6;
            checkBoxB7.Checked = bb14.Bit7;


            SuperByte bb15 = new SuperByte(Controller.INFO.rawData[15]);

            checkBox9.Checked = bb15.Bit7;
            checkBox8.Checked = bb15.Bit6;
            checkBox7.Checked = bb15.Bit5;
            checkBox6.Checked = bb15.Bit4;
            checkBox5.Checked = bb15.Bit3;
            checkBox4.Checked = bb15.Bit2;
            checkBox3.Checked = bb15.Bit1;
            checkBox2.Checked = bb15.Bit0;


            SuperByte bb19 = new SuperByte(Controller.INFO.rawData[19]);

            checkBox10.Checked = bb19.Bit0;
            checkBox11.Checked = bb19.Bit1;
            checkBox12.Checked = bb19.Bit2;
            checkBox13.Checked = bb19.Bit3;
            checkBox14.Checked = bb19.Bit4;
            checkBox15.Checked = bb19.Bit5;
            checkBox16.Checked = bb19.Bit6;
            checkBox17.Checked = bb19.Bit7;


            label_FreeSizeBuffer.Text = Controller.INFO.FreebuffSize.ToString();

            // end debug
        }
예제 #3
0
        /// <summary>
        /// Запуск движения без остановки
        /// </summary>
        /// <param name="x">Ось Х (доступные значения "+" "0" "-")</param>
        /// <param name="y">Ось Y (доступные значения "+" "0" "-")</param>
        /// <param name="z">Ось Z (доступные значения "+" "0" "-")</param>
        /// <param name="speed"></param>
        public static void StartManualMove(string x, string y, string z, int speed)
        {
            if (!Connected)
            {
                //stringError = "Для выключения шпинделя, нужно вначале установить связь с контроллером";
                //return false;
                return;
            }

            //if (!IsFreeToTask)
            //{
            //    return;
            //}

            SuperByte axesDirection = new SuperByte(0x00);
            //поставим нужные биты
            if (x == "-") axesDirection.SetBit(0, true);
            if (x == "+") axesDirection.SetBit(1, true);
            if (y == "-") axesDirection.SetBit(2, true);
            if (y == "+") axesDirection.SetBit(3, true);
            if (z == "-") axesDirection.SetBit(4, true);
            if (z == "+") axesDirection.SetBit(5, true);

            //DataClear();
            //DataAdd(BinaryData.pack_BE(axesDirection.valueByte, speed));
            SendBinaryData(BinaryData.pack_BE(axesDirection.ValueByte, speed,x,y,z));
            //Task_Start();
        }
예제 #4
0
        /// <summary>
        /// Парсит полученные данные с контроллера
        /// </summary>
        /// <param name="readBuffer"></param>
        private static void ParseInfo(IList<byte> readBuffer)
        {

            int ttm = (int)(((readBuffer[22] * 65536) + (readBuffer[21] * 256) + (readBuffer[20])) / 2.1);

            if (ttm > 5000) return;

            //TODO: иногда в МК2 бывает глюк, поэтому защитимся от него, костылем
            //if (readBuffer[10] == 0x58 && readBuffer[11] == 0x02 && readBuffer[22] == 0x20 && readBuffer[23] == 0x02) return;

            INFO.FreebuffSize = readBuffer[1];

            INFO.shpindel_MoveSpeed = 0;

            if (GlobalSetting.AppSetting.Controller == ControllerModel.PlanetCNC_MK1)
            {
                INFO.shpindel_MoveSpeed = (int)(((readBuffer[22] * 65536) + (readBuffer[21] * 256) + (readBuffer[20])) / 2.1);
            }

            if (GlobalSetting.AppSetting.Controller == ControllerModel.PlanetCNC_MK2)
            {
                INFO.shpindel_MoveSpeed = (int)(((readBuffer[22] * 65536) + (readBuffer[21] * 256) + (readBuffer[20])) / 1.341);
            }



            INFO.shpindel_MoveSpeedSumm = (INFO.shpindel_MoveSpeedSumm + INFO.shpindel_MoveSpeed)/2;

            INFO.shpindel_STOPPED = INFO.shpindel_MoveSpeedSumm == 0;



            INFO.AxesX_PositionPulse = (readBuffer[27] * 16777216) + (readBuffer[26] * 65536) + (readBuffer[25] * 256) + (readBuffer[24]);
            INFO.AxesY_PositionPulse = (readBuffer[31] * 16777216) + (readBuffer[30] * 65536) + (readBuffer[29] * 256) + (readBuffer[28]);
            INFO.AxesZ_PositionPulse = (readBuffer[35] * 16777216) + (readBuffer[34] * 65536) + (readBuffer[33] * 256) + (readBuffer[32]);
            INFO.AxesA_PositionPulse = (readBuffer[39] * 16777216) + (readBuffer[38] * 65536) + (readBuffer[37] * 256) + (readBuffer[36]);

            INFO.AxesX_LimitMax = (readBuffer[15] & (1 << 0)) != 0;
            INFO.AxesX_LimitMin = (readBuffer[15] & (1 << 1)) != 0;
            INFO.AxesY_LimitMax = (readBuffer[15] & (1 << 2)) != 0;
            INFO.AxesY_LimitMin = (readBuffer[15] & (1 << 3)) != 0;
            INFO.AxesZ_LimitMax = (readBuffer[15] & (1 << 4)) != 0;
            INFO.AxesZ_LimitMin = (readBuffer[15] & (1 << 5)) != 0;

            INFO.NuberCompleatedInstruction = readBuffer[9] * 16777216 + (readBuffer[8] * 65536) + (readBuffer[7] * 256) + (readBuffer[6]);


            SuperByte bb = new SuperByte(readBuffer[19]);

            INFO.shpindel_Enable = bb.Bit0;

            SuperByte bb2 = new SuperByte(readBuffer[14]);
            INFO.Estop = bb2.Bit7;
        }