private bool RefreshRange(int i_iChannel) { byte byRange, bySlewrate; bool bRet; if (m_b5000) { bRet = adamCom.AnalogOutput(m_iAddr).GetConfiguration(m_iSlot, i_iChannel, out byRange, out bySlewrate); } else { bRet = adamSocket.AnalogOutput(m_iAddr).GetConfiguration(m_iSlot, i_iChannel, out byRange); } if (bRet) { m_byRange[i_iChannel] = byRange; } return(bRet); }
private void RefreshAoChannelRange(int i_iChannel) { byte byRange; if (adamModbus.AnalogOutput().GetConfiguration(i_iChannel, out byRange)) { m_byAoRange[i_iChannel] = byRange; } else { txtReadCount.Text += "GetConfiguration() failed;"; } }
private void RefreshAoChannelRange(int i_iChannel, bool i_bRefresh) { ushort usRange; if (adamModbus.AnalogOutput().GetOutputRange(i_iChannel, out usRange)) { m_usRange[i_iChannel] = usRange; if (i_bRefresh) { for (int i = 0; i < cbxAoOutputRange.Items.Count; i++) { if (((ComboItem)cbxAoOutputRange.Items[i]).GetCode() == usRange) { cbxAoOutputRange.SelectedIndex = i; break; } } } } else { MessageBox.Show("GetRangeCode() failed;"); } }
/// <summary> /// Refresh AI Channel Information /// </summary> /// <returns></returns> private bool RefreshData() { int iChannelTotal = this.m_aConf.HwIoTotal[m_tmpidx]; ushort[] usVal; string[] strVal; float fHigh = 0, fLow = 0; if (!m_adamSocket.AnalogOutput().GetValues(m_idxID, iChannelTotal, out usVal)) { StatusBar_IO.Text += "ApiErr:" + m_adamSocket.Modbus().LastError.ToString() + " "; return(false); } strVal = new string[usVal.Length]; for (int i = 0; i < iChannelTotal; i++) { if (this.IsShowRawData) { strVal[i] = usVal[i].ToString("X04"); } else { strVal[i] = AnalogOutput.GetScaledValue(this.m_usRanges[i], usVal[i]).ToString(AnalogOutput.GetFloatFormat(this.m_usRanges[i])); } listViewChInfo.Items[i].SubItems[3].Text = strVal[i].ToString(); //moduify "Value" column } //Update tBarOutputVal if (!b_AOValueModified) { int idx = 0; for (int i = 0; i < listViewChInfo.Items.Count; i++) { if (listViewChInfo.Items[i].Selected) { idx = i; } } AnalogOutput.GetRangeHighLow(m_usRanges[idx], out fHigh, out fLow); RefreshOutputPanel(fHigh, fLow, AnalogOutput.GetScaledValue(this.m_usRanges[idx], usVal[idx])); } return(true); }