public SerialTerm() { InitializeComponent();
InitComPort();
com.Output = "Serial Terminal Initialized"; }
private void InitComPort() { com.CommPort = 1; if (com.PortOpen) com.PortOpen = false; com.RThreshold = 1; com.Settings = "9600,n,8,1";
com.DTREnable = true; com.Handshaking = MSCommLib.HandshakeConstants.comNone;
com.InputMode = MSCommLib.InputModeConstants.comInputModeText; com.InputLen = 0;
com.NullDiscard = false; com.OnComm += new System.EventHandler(this.OnComm); com.PortOpen = true; }
private void OnComm(object sender, EventArgs e) { if (com.InBufferCount > 0) ProcessComData((string) com.Input); }
private void ProcessComData(string input) { rtfTerminal.AppendText(input + "\n"); }
|