private void Send_Data_Transmit(byte[] data, int len) { _101_function _101_Function = new _101_function(); if (data[0] == (byte)_101_config.IEC_101_Msg.fixed_state_code) { data[len++] = _101_Function.Get_CS(data, 1, 3); } else { data[len++] = _101_Function.Get_CS(data, 4, len - 4); } data[len++] = (byte)_101_config.IEC_101_Msg.end_code; SerialPort_config serialPort = new SerialPort_config(); serialPort.Send_Data(data, len); }
private void button2_Click(object sender, EventArgs e) { SerialPort_config port_Config = new SerialPort_config(); port_Config.Send_Data(serialPort1, textBox2.Text);//发送数据 }