private void buttonGetGPIO_Click(object sender, EventArgs e) { byte OutputPin = 0; try { ErrorsCatcher.errorName = RWDev.GetGPIOStatus(ref RWDev.comAddress, ref OutputPin, RWDev.frmComPortIndex); if (ErrorsCatcher.errorName != 0) { string strLog = "Get GPIO status failed " + ErrorsCatcher.GetReturnCodeDesc(ErrorsCatcher.errorName) + Environment.NewLine; richTextBoxLogs.AppendText(strLog); return; } else { if ((OutputPin & 0x10) == 0x10) { checkBoxOUT1.Checked = true; } else { checkBoxOUT1.Checked = false; } if ((OutputPin & 0x20) == 0x20) { checkBoxOUT2.Checked = true; } else { checkBoxOUT2.Checked = false; } if ((OutputPin & 0x01) == 1) { checkBoxINT1.Checked = true; } else { checkBoxINT1.Checked = false; } if ((OutputPin & 0x02) == 2) { checkBoxINT2.Checked = true; } else { checkBoxINT2.Checked = false; } string strLog = "Get GPIO status success " + Environment.NewLine; richTextBoxLogs.AppendText(strLog); } } catch { richTextBoxLogs.AppendText("Get GPIO failed!" + Environment.NewLine); } }