Exemplo n.º 1
0
        private void btn_Datawriting_M_Click(object sender, EventArgs e)
        {
            string text  = com_Functioncode_M.Text;
            string text2 = text;

            if (text2 != null && text2 == "0x0F")
            {
                com_Functioncode_M.Text = "15";
            }
            objModbus.ReadOutputStatus_M(Convert.ToByte(txt_Slave_M.Text), Convert.ToUInt16(com_Functioncode_M.Text), Convert.ToUInt16(txt_Start_M.Text), Convert.ToUInt16(txt_Length_M.Text), Convert.ToUInt16(txt_Datawriting_M.Text));
        }
        /// <summary>
        /// M区发送数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Datawriting_M_Click(object sender, EventArgs e)
        {
            switch (this.com_Functioncode_M.Text)
            {
            case "0x0F":
                this.com_Functioncode_M.Text = "15";
                break;
            }

            objModbus.ReadOutputStatus_M(Convert.ToByte(this.txt_Slave_M.Text), Convert.ToUInt16(this.com_Functioncode_M.Text), Convert.ToUInt16(this.txt_Start_M.Text), Convert.ToUInt16(this.txt_Length_M.Text), Convert.ToUInt16(this.txt_Datawriting_M.Text));
        }