Exemplo n.º 1
0
        private void 通道2ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Register.Byte83H = (byte)(Register.Byte83H | 0x04);
            USB.SendCMD(Data.OnlyId, 0x83, Register.Byte83H);

            Register.Byte83H = (byte)(Register.Byte83H & 0x7b);
            USB.SendCMD(Data.OnlyId, 0x83, Register.Byte83H);

            USB.SendData(Data.OnlyId, StrToHexByte("1D020004" + "00304591" + "C0DEC0DEC0DEC0DEC0DEC0DEC0DEC0DE"));


            Register.Byte83H = (byte)(Register.Byte83H | 0x04);
            USB.SendCMD(Data.OnlyId, 0x83, Register.Byte83H);

            Register.Byte83H = (byte)(Register.Byte83H & 0x7b);
            USB.SendCMD(Data.OnlyId, 0x83, Register.Byte83H);

            USB.SendData(Data.OnlyId, StrToHexByte("1D020004" + "00314431" + "C0DEC0DEC0DEC0DEC0DEC0DEC0DEC0DE"));
        }
Exemplo n.º 2
0
        private void button28_Click(object sender, EventArgs e)
        {
            Register.Byte83H = (byte)(Register.Byte83H | 0x01);
            USB.SendCMD(Data.OnlyId, 0x83, Register.Byte83H);

            Register.Byte83H = (byte)(Register.Byte83H & 0x7e);
            USB.SendCMD(Data.OnlyId, 0x83, Register.Byte83H);

            double V = (double)numericUpDown5.Value;

            int    mazi        = (int)((V * 4095) / 10);
            string value       = mazi.ToString("x4");
            String Str_Content = "01 06 00 03 " + value.Substring(0, 2) + " " + value.Substring(2, 2);
            int    lenth       = (Str_Content.Length) / 2 + 2;

            if (lenth >= 0)
            {
                string crc  = Data.CRCCalc(Str_Content).Replace(" ", "").PadLeft(4, '0');
                byte[] temp = StrToHexByte("1D00" + lenth.ToString("x4") + Str_Content + crc + "C0DEC0DEC0DEC0DEC0DEC0DEC0DEC0DE");

                USB.SendData(Data.OnlyId, temp);
            }
        }