Пример #1
0
        private void btnMotor_Click(object sender, EventArgs e)         //Motor
        {
            var msgRmp = new BSDB232()
            {
                ID    = 0x01,
                CMD   = 0x52,
                AddrH = 0x70,
                AddrL = 0xB1,
                ErrR  = 0x00,
                Dat1  = GeneralConver.ToIntBytes(speedMotor)[3],    //MSB
                Dat2  = GeneralConver.ToIntBytes(speedMotor)[2],
                Dat3  = GeneralConver.ToIntBytes(speedMotor)[1],
                Dat4  = GeneralConver.ToIntBytes(speedMotor)[0] //LSB
                                                                //Dat3    = 0x01,
                                                                //Dat4    = 0xF4,
                                                                //Check   = 0x69
            };

            Serial1PcToMcu(msgRmp);
        }
Пример #2
0
        private void btnRpmDown_Click(object sender, EventArgs e)       //RpmDown
        {
            speedMotor -= 50;
            if (speedMotor < 50)
            {
                MessageBox.Show("已超出最小转速!");
                return;
            }
            var msgRmp = new BSDB232()
            {
                ID    = 0x01,
                CMD   = 0x52,
                AddrH = 0x70,
                AddrL = 0xB1,
                ErrR  = 0x00,
                Dat1  = GeneralConver.ToIntBytes(speedMotor)[3],  //MSB
                Dat2  = GeneralConver.ToIntBytes(speedMotor)[2],
                Dat3  = GeneralConver.ToIntBytes(speedMotor)[1],
                Dat4  = GeneralConver.ToIntBytes(speedMotor)[0]   //LSB
            };

            Serial1PcToMcu(msgRmp);
        }