private void radioButtonConnect_Click_1(object sender, EventArgs e) { if (!radioButtonConnect.Checked) { if (comboBoxBaud.SelectedIndex == 0) { MessageBox.Show("Please Select a Baud Rate."); return; } uint baudValue = 0; for (int i = 0; i < baudList.Length; i++) { if (comboBoxBaud.SelectedItem.ToString() == baudList[i].baudRate) { baudValue = baudList[i].baudValue; break; } if ((i + 1) == baudList.Length) {// didn't find it- must be custom try { float baudRate = float.Parse(comboBoxBaud.SelectedItem.ToString()); baudRate = ((1F / baudRate) - 3e-6F) / 1.6667e-7F; baudValue = 0x10000 - (uint)baudRate; } catch { MessageBox.Show("Error with Baud setting."); return; } } } panelVdd.Enabled = false; // no VDD changes when connected Pk2.EnterUARTMode(baudValue); radioButtonConnect.Checked = true; radioButtonDisconnect.Checked = false; buttonString1.Enabled = true; buttonString2.Enabled = true; buttonString3.Enabled = true; buttonString4.Enabled = true; comboBoxBaud.Enabled = false; // can't change value when connected. if (baudValue < 0xEC8A) { // 1200 or less: slower polling timerPollForData.Interval = 75; } else { // faster timerPollForData.Interval = 15; } timerPollForData.Enabled = true; } }