static SerialPort serialPort = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One); //定义一个串口类的串口变量

        #endregion Fields

        #region Methods

        static void Main(string[] args)
        {
            Menu menu = new Menu("串口通信示例");
            menu.AddCommand("status", new Function(ShowStatus));
            menu.AddCommand("switch", new Function(SwitchPort));
            menu.AddCommand("set", new Function(SetPort));
            menu.AddCommand("send", new Function(SendData));
            menu.Start();
        }