private void PrintExpInfo(MccDaq.MccBoard pBoard) { // Get the number of Exps attached to pBoard int numEXPs = 0; MccDaq.ErrorInfo ULStat = pBoard.BoardConfig.GetNumExps(out numEXPs); int BoardType = 0; int ADChan1 = 0; int ADChan2 = 0; for (int expNum=0; expNum<numEXPs; ++expNum) { pBoard.ExpansionConfig.GetBoardType(expNum, out BoardType); pBoard.ExpansionConfig.GetMuxAdChan1(expNum, out ADChan1); if (BoardType == 770) { // it's a CIO-EXP32 pBoard.ExpansionConfig.GetMuxAdChan2(expNum, out ADChan2); Info += " A/D channels " + ADChan1.ToString("0") + " and " + ADChan2.ToString("0")+ " connected to EXP(devID=" +BoardType.ToString("0") + ")." + LF; } else Info += " A/D channel " + ADChan1.ToString("0") + " connected to EXP(devID=" + BoardType.ToString("0") + ")." + LF; } if (Info.Length != 0) Info += LF; }
private void PrintDAInfo(MccDaq.MccBoard pBoard) { int numDAChans = 0; MccDaq.ErrorInfo ULStat = pBoard.BoardConfig.GetNumDaChans(out numDAChans); if (numDAChans > 0) Info += " Number of D/A channels: " + numDAChans.ToString("0") + LF; }
private void PrintDigInfo(MccDaq.MccBoard pBoard) { // get the number of digital devices for this board int numDIPorts = 0; MccDaq.ErrorInfo ULStat = pBoard.BoardConfig.GetDiNumDevs(out numDIPorts); int numBits = 0; for (int portNum=0; portNum<numDIPorts; ++portNum) { // For each digital device, get the base address and number of bits numBits = 0; ULStat = pBoard.DioConfig.GetNumBits(portNum, out numBits); Info += " Digital Device #" + portNum.ToString("0") + " : " + numBits.ToString("0") + " bits" + LF; } }
public static void MyCallback(int bd, MccDaq.EventType et, uint sampleCount, IntPtr pUserData) { //MyCallback is a static member function. So, we must do some work to get the reference // to this object. Recall that we passed in a pointer to a struct that wrapped the // class reference as UserData. TUserData userStruct = (TUserData)Marshal.PtrToStructure(pUserData,typeof(TUserData)); frmEventDisplay ThisObj = (frmEventDisplay)userStruct.ThisObj; //Calculate the index of the latest sample in the buffer. int sampleIdx = ((int)sampleCount-1) % ThisObj.TotalCount; ushort rawData; float voltData; //Retrieve the latest sample and convert it to engineering units. MccDaq.MccService.WinBufToArray(ThisObj.hBuffer, out rawData, (int)sampleIdx, 1); ThisObj.DaqBoard.ToEngUnits(ThisObj.Range, rawData, out voltData); // Update display values. ThisObj.lblSampleCount.Text = sampleCount.ToString(); ThisObj.lblLatestSample.Text = voltData.ToString("F4")+" V"; ThisObj.lblStatus.Text = "RUNNING"; if (et==MccDaq.EventType.OnEndOfAiScan) { //If the event is the end of acquisition, release the resources in preparation for // the next scan. ThisObj.DaqBoard.StopBackground(MccDaq.FunctionType.AiFunction); if (ThisObj.chkAutoRestart.Checked) { int rate = ThisObj.DesiredRate; ThisObj.DaqBoard.AInScan(0, 0, ThisObj.TotalCount, ref rate, ThisObj.Range, ThisObj.hBuffer, ThisObj.Options); } else { ThisObj.lblStatus.Text = "IDLE"; } } }
private void PrintCtrInfo(MccDaq.MccBoard pBoard) { // Get the number of counter devices for this board int numCounters = 0; MccDaq.ErrorInfo ULStat = pBoard.BoardConfig.GetCiNumDevs(out numCounters); if (numCounters > 0) Info += " Counters : " + numCounters.ToString("0") + LF; if (Info.Length != 0) Info += LF; }
public static void MyCallback(int bd, MccDaq.EventType et, uint sampleCount, IntPtr pdata) { //MyCallback is a static member function. So, we must do some work to get the reference // to this object. Recall that we passed in a pointer to a struct that wrapped the // class reference as UserData. TUserData userStruct = (TUserData)Marshal.PtrToStructure(pdata,typeof(TUserData)); frmEventDisplay ThisObj = (frmEventDisplay)userStruct.ThisObj; MccDaq.ErrorInfo ULStat; // update display values ThisObj.lblStatus.Text = "RUNNING"; if (et==MccDaq.EventType.OnPretrigger) { // store actual number of pre-trigger samples collected ThisObj.ActualPreCount = (int)sampleCount; ThisObj.lblPreCount.Text = sampleCount.ToString(); // signal external device that trigger has been detected ULStat = ThisObj.DaqBoard.DOut(MccDaq.DigitalPortType.AuxPort, 0xff); } else { // Give the library a chance to clean up ULStat = ThisObj.DaqBoard.StopBackground(MccDaq.FunctionType.AiFunction); ThisObj.lblStatus.Text = "IDLE"; //Deassert external device signal ULStat = ThisObj.DaqBoard.DOut(MccDaq.DigitalPortType.AuxPort, 0); // Get the data and align it so that oldest data is first ULStat = MccDaq.MccService.WinBufToArray(ThisObj.hBuffer, out ThisObj.Data[0], 0, BufferSize - 1); ULStat = ThisObj.DaqBoard.AConvertPretrigData( ThisObj.ActualPreCount, TotalCount, ref ThisObj.Data[0], out ThisObj.ChanTags[0]); float engData; int PreTriggerIndex, PostTriggerIndex; // Update the Pre- and Post- Trigger data displays for(int offset=0; offset<10; ++offset) { // Determine the data index with respect to the trigger index PreTriggerIndex = ThisObj.ActualPreCount - 10 + offset; PostTriggerIndex = ThisObj.ActualPreCount + offset; // Avoid indexing invalid pretrigger data if (10 - offset < System.Convert.ToInt32(ThisObj.ActualPreCount)) { ULStat = ThisObj.DaqBoard.ToEngUnits(ThisObj.Range, ThisObj.Data[PreTriggerIndex], out engData); ThisObj.lblPreTriggerData[offset].Text = engData.ToString("#0.0000") + "V"; } else // this index doesn't point to valid data ThisObj.lblPreTriggerData[offset].Text = "NA"; ULStat = ThisObj.DaqBoard.ToEngUnits(ThisObj.Range, ThisObj.Data[PostTriggerIndex], out engData); ThisObj.lblPostTriggerData[offset].Text = engData.ToString("#0.0000") + "V"; } if (ThisObj.chkAutoRestart.CheckState == CheckState.Checked) { // Start a new scan int rate = ThisObj.DesiredRate; int preCount = ThisObj.PreCount; int count = TotalCount; int VarPreCount = ThisObj.PreCount; ULStat = ThisObj.DaqBoard.APretrig(Channel, Channel, ref preCount, ref count, ref rate, ThisObj.Range, ThisObj.hBuffer, ThisObj.Options); ThisObj.lblStatus.ForeColor = System.Drawing.ColorTranslator.FromOle(0x00ff0000); ThisObj.lblStatus.Text = "RUNNING"; ThisObj.lblPreCount.Text = "NA"; } } }
public void setRange(MccDaq.Range _range) { range = _range; }
private void GetRangeInfo(MccDaq.Range Range, out string RangeString, out float RangeVolts) { switch (Range) { case MccDaq.Range.NotUsed: RangeString = "NOTUSED"; RangeVolts = 0; break; case MccDaq.Range.Bip60Volts: RangeString = "BIP60VOLTS"; RangeVolts = 120; break; case MccDaq.Range.Bip30Volts: RangeString = "BIP30VOLTS"; RangeVolts = 60; break; case MccDaq.Range.Bip20Volts: RangeString = "BIP20VOLTS"; RangeVolts = 40; break; case MccDaq.Range.Bip15Volts: RangeString = "BIP15VOLTS"; RangeVolts = 30; break; case Range.Bip10Volts: RangeString = "BIP10VOLTS"; RangeVolts = 20; break; case Range.Bip5Volts: RangeString = "BIP5VOLTS"; RangeVolts = 10; break; case MccDaq.Range.Bip4Volts: RangeString = "BIP4VOLTS"; RangeVolts = 8; break; case Range.Bip2Pt5Volts: RangeString = "BIP2PT5VOLTS"; RangeVolts = 5; break; case MccDaq.Range.Bip2Volts: RangeString = "BIP2VOLTS"; RangeVolts = 4; break; case Range.Bip1Pt25Volts: RangeString = "BIP1PT25VOLTS"; RangeVolts = 2.5F; break; case Range.Bip1Volts: RangeString = "BIP1VOLTS"; RangeVolts = 2; break; case Range.BipPt625Volts: RangeString = "BIPPT625VOLTS"; RangeVolts = 1.25F; break; case Range.BipPt5Volts: RangeString = "BIPPT5VOLTS"; RangeVolts = 1; break; case Range.BipPt1Volts: RangeString = "BIPPT1VOLTS"; RangeVolts = 0.2F; break; case Range.BipPt05Volts: RangeString = "BIPPT05VOLTS"; RangeVolts = 0.1F; break; case MccDaq.Range.BipPt312Volts: RangeString = "BIPPT312VOLTS"; RangeVolts = 0.624F; break; case MccDaq.Range.BipPt25Volts: RangeString = "BIPPT25VOLTS"; RangeVolts = 0.5F; break; case MccDaq.Range.BipPt2Volts: RangeString = "BIPPT2VOLTS"; RangeVolts = 0.4F; break; case MccDaq.Range.BipPt156Volts: RangeString = "BIPPT156VOLTS"; RangeVolts = 0.3125F; break; case MccDaq.Range.BipPt125Volts: RangeString = "BIPPT125VOLTS"; RangeVolts = 0.25F; break; case MccDaq.Range.BipPt078Volts: RangeString = "BIPPT078VOLTS"; RangeVolts = 0.15625F; break; case Range.BipPt01Volts: RangeString = "BIPPT01VOLTS"; RangeVolts = 0.02F; break; case Range.BipPt005Volts: RangeString = "BIPPT005VOLTS"; RangeVolts = 0.01F; break; case Range.Bip1Pt67Volts: RangeString = "BIP1PT67VOLTS"; RangeVolts = 3.34F; break; case Range.Uni10Volts: RangeString = "UNI10VOLTS"; RangeVolts = 10; break; case Range.Uni5Volts: RangeString = "UNI5VOLTS"; RangeVolts = 5; break; case MccDaq.Range.Uni4Volts: RangeString = "UNI4VOLTS"; RangeVolts = 4.096F; break; case Range.Uni2Pt5Volts: RangeString = "UNI2PT5VOLTS"; RangeVolts = 2.5F; break; case Range.Uni2Volts: RangeString = "UNI2VOLTS"; RangeVolts = 2; break; case Range.Uni1Pt25Volts: RangeString = "UNI1PT25VOLTS"; RangeVolts = 1.25F; break; case Range.Uni1Volts: RangeString = "UNI1VOLTS"; RangeVolts = 1; break; case MccDaq.Range.UniPt25Volts: RangeString = "UNIPT25VOLTS"; RangeVolts = 0.25F; break; case MccDaq.Range.UniPt2Volts: RangeString = "UNIPT2VOLTS"; RangeVolts = 0.2F; break; case Range.UniPt1Volts: RangeString = "UNIPT1VOLTS"; RangeVolts = 0.1F; break; case MccDaq.Range.UniPt05Volts: RangeString = "UNIPT05VOLTS"; RangeVolts = 0.05F; break; case Range.UniPt01Volts: RangeString = "UNIPT01VOLTS"; RangeVolts = 0.01F; break; case Range.UniPt02Volts: RangeString = "UNIPT02VOLTS"; RangeVolts = 0.02F; break; case Range.Uni1Pt67Volts: RangeString = "UNI1PT67VOLTS"; RangeVolts = 1.67F; break; case Range.Ma4To20: RangeString = "MA4TO20"; RangeVolts = 16; break; case Range.Ma2To10: RangeString = "MA2to10"; RangeVolts = 8; break; case Range.Ma1To5: RangeString = "MA1TO5"; RangeVolts = 4; break; case Range.MaPt5To2Pt5: RangeString = "MAPT5TO2PT5"; RangeVolts = 2; break; case MccDaq.Range.Ma0To20: RangeString = "MA0TO20"; RangeVolts = 20; break; case MccDaq.Range.BipPt025Amps: RangeString = "BIPPT025A"; RangeVolts = 0.05F; break; case MccDaq.Range.BipPt025VoltsPerVolt: RangeString = "BIPPT025VPERV"; RangeVolts = 0.05F; break; default: RangeString = "NOTUSED"; RangeVolts = 0; break; } }
public int FindAnalogChansOfType(MccDaq.MccBoard DaqBoard, int AnalogType, out int Resolution, out MccDaq.Range DefaultRange, out int DefaultChan, out MccDaq.TriggerType DefaultTrig) { int ChansFound, IOType; MccDaq.ErrorInfo ULStat; bool CheckPretrig, CheckATrig = false; MccDaq.Range TestRange; bool RangeFound; // check supported features by trial // and error with error handling disabled ULStat = MccDaq.MccService.ErrHandling (MccDaq.ErrorReporting.DontPrint, MccDaq.ErrorHandling.DontStop); TestBoard = DaqBoard; ATrigRes = 0; DefaultChan = 0; DefaultTrig = TriggerType.TrigPosEdge; DefaultRange = Range.NotUsed; Resolution = 0; IOType = (AnalogType & 3); switch (IOType) { case ANALOGINPUT: // Get the number of A/D channels ULStat = DaqBoard.BoardConfig.GetNumAdChans(out ChansFound); if (!(ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)) { clsErrorDefs.DisplayError(ULStat); return ChansFound; } if (ChansFound > 0) { // Get the resolution of A/D ULStat = DaqBoard.BoardConfig.GetAdResolution(out ADRes); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) Resolution = ADRes; // check ranges for a valid default RangeFound = TestInputRanges(out TestRange); if (RangeFound) DefaultRange = TestRange; } break; default: // Get the number of D/A channels ULStat = DaqBoard.BoardConfig.GetNumDaChans(out ChansFound); if (!(ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors)) { clsErrorDefs.DisplayError(ULStat); return ChansFound; } if (ChansFound > 0) { ULStat = TestBoard.GetConfig(2, 0, 292, out DARes); Resolution = DARes; RangeFound = TestOutputRanges(out TestRange); if (RangeFound) DefaultRange = TestRange; } break; } CheckATrig = ((AnalogType & ATRIGIN) == ATRIGIN); if ((ChansFound > 0) & CheckATrig) { ULStat = DaqBoard.SetTrigger(MccDaq.TriggerType.TrigAbove, 0, 0); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) { DefaultTrig = MccDaq.TriggerType.TrigAbove; GetTrigResolution(); } else ChansFound = 0; } CheckPretrig = ((AnalogType & PRETRIGIN) == PRETRIGIN); if ((ChansFound > 0) & CheckPretrig) { // if DaqSetTrigger supported, trigger type is analog ULStat = DaqBoard.DaqSetTrigger(MccDaq.TriggerSource.TrigImmediate, MccDaq.TriggerSensitivity.AboveLevel, 0, MccDaq.ChannelType.Analog, DefaultRange, 0.0F, 0.1F, MccDaq.TriggerEvent.Start); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) DefaultTrig = MccDaq.TriggerType.TrigAbove; else { ULStat = DaqBoard.SetTrigger(MccDaq.TriggerType.TrigPosEdge, 0, 0); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) DefaultTrig = MccDaq.TriggerType.TrigPosEdge; else ChansFound = 0; } } ULStat = MccDaq.MccService.ErrHandling (clsErrorDefs.ReportError, clsErrorDefs.HandleError); return ChansFound; }
private void OnStatusChanged(MccDaq.ErrorInfo newStatus) { // TBD }
public float GetRangeVolts(MccDaq.Range Range) { string RangeString; float RangeVolts; GetRangeInfo(Range, out RangeString, out RangeVolts); return RangeVolts; }
private void addPortInformationToDictionary( IDictionary<String, MccPortInformation> _portInfoDict, MccDaq.DigitalPortType _digitalPortType, String _portNamePrefix, byte _numberOfBits, byte _bitOffset) { for (byte i = 0; i < _numberOfBits; i++) { MccPortInformation mccPortInformation = new MccPortInformation(_portNamePrefix + (i + _bitOffset).ToString(), _digitalPortType,i); _portInfoDict.Add(mccPortInformation.Name, mccPortInformation); } }
public static void MyCallback(int bd, MccDaq.EventType et, uint interruptCount, IntPtr pUserData) { //MyCallback is a static member function. So, we must do some work to get the reference // to this object. Recall that we passed in a pointer to a struct that wrapped the // class reference as UserData. TUserData userStruct = (TUserData)Marshal.PtrToStructure(pUserData,typeof(TUserData)); frmEventDisplay ThisObj = (frmEventDisplay)userStruct.ThisObj; ThisObj._eventCount++; // these updates below are "expensive"; so, only do them every // _updateSize interrupts. if (interruptCount >= ThisObj._intCount + _updateSize) { ThisObj._intCount = interruptCount; //read the digital ushort digVal = 0; MccDaq.ErrorInfo ULStat = ThisObj.DaqBoard.DIn(MccDaq.DigitalPortType.FirstPortA, out digVal); if (ULStat.Value != MccDaq.ErrorInfo.ErrorCode.NoErrors) ThisObj.DaqBoard.DisableEvent(MccDaq.EventType.AllEventTypes); ThisObj.lblInterruptCount.Text = Convert.ToString(ThisObj._intCount); ThisObj.lblEventCount.Text = Convert.ToString(ThisObj._eventCount); ThisObj.lblInterruptsMissed.Text = (ThisObj._intCount - ThisObj._eventCount).ToString(); ThisObj.lblDigitalIn.Text = "0x"+digVal.ToString("x2"); } }
public static void OnScanError(int bd, MccDaq.EventType et, uint scanError, IntPtr pdata) { //OnScanError is a static member function. So, we must do some work to get the reference // to this object. Recall that we passed in a pointer to a struct that wrapped the // class reference as UserData... TUserData thisStruct = (TUserData)Marshal.PtrToStructure(pdata,typeof(TUserData)); frmEventDisplay ThisObj = (frmEventDisplay)thisStruct.ThisObj; ThisObj.DaqBoard.StopBackground(MccDaq.FunctionType.AiFunction); // Reset the chkAutoRestart such that the 'OnEndOfAiScan' event does //not automatically start a new scan ThisObj.chkAutoRestart.Checked = false; }
private void PrintGenInfo(MccDaq.MccBoard pBoard) { // Get board type of each board int BoardType = 0; MccDaq.ErrorInfo ULStat = pBoard.BoardConfig.GetBoardType(out BoardType); if (BoardType > 0) // If a board is installed { // Get the board's name BoardName = pBoard.BoardName; BoardName = BoardName.TrimEnd(); // Drop the space characters int StringSize = BoardName.Length - 1; // Drop the null character at end of string BoardName = BoardName.Substring(0, StringSize); Info += "Board #" + pBoard.BoardNum.ToString("0") + " = " + BoardName +" at "; // Get the board's base address int baseAdr = 0; ULStat = pBoard.BoardConfig.GetBaseAdr(0, out baseAdr); Info += "Base Address = " + baseAdr.ToString("X") + " hex." + LF + LF; } }
private bool TestInputRanges(out MccDaq.Range DefaultRange) { short dataValue; int dataHRValue, Options, index; MccDaq.ErrorInfo ULStat; MccDaq.Range TestRange; bool RangeFound = false; ValidRanges = new MccDaq.Range[49]; DefaultRange = MccDaq.Range.NotUsed; TestRange = MccDaq.Range.NotUsed; Options = 0; index = 0; foreach (int i in Enum.GetValues(TestRange.GetType())) { TestRange = (MccDaq.Range) i; if (ADRes > 16) ULStat = TestBoard.AIn32(0, TestRange, out dataHRValue, Options); else ULStat = TestBoard.AIn(0, TestRange, out dataValue); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) { if (DefaultRange == MccDaq.Range.NotUsed) DefaultRange = TestRange; ValidRanges.SetValue(TestRange, index); index = index + 1; RangeFound = true; } } Array.Resize(ref ValidRanges, index); return RangeFound; }
public static void TestException(MccDaq.ErrorInfo stat, object sender, string msg) { if (stat.Value != ErrorInfo.ErrorCode.NoErrors) throw new BoardErrorException(sender, msg); }
private bool TestOutputRanges(out MccDaq.Range DefaultRange) { short dataValue = 0; MccDaq.ErrorInfo ULStat; MccDaq.Range TestRange; bool RangeFound = false; int configVal; DefaultRange = MccDaq.Range.NotUsed; TestRange = (MccDaq.Range)(-5); ULStat = TestBoard.AOut(0, TestRange, dataValue); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) { ULStat = TestBoard.GetConfig(2, 0, 114, out configVal); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) { DefaultRange = (MccDaq.Range)configVal; RangeFound = true; } } else { TestRange = MccDaq.Range.NotUsed; foreach (int i in Enum.GetValues(TestRange.GetType())) { TestRange = (MccDaq.Range)i; ULStat = TestBoard.AOut(0, TestRange, dataValue); if (ULStat.Value == MccDaq.ErrorInfo.ErrorCode.NoErrors) { if (DefaultRange == MccDaq.Range.NotUsed) DefaultRange = TestRange; RangeFound = true; break; } } } return RangeFound; }
public static void OnScanError(int bd, MccDaq.EventType et, uint scanError, IntPtr pdata) { //OnScanError is a static member function. So, we must do some work to get the reference // to this object. Recall that we passed in a pointer to a struct that wrapped the // class reference as UserData. TUserData thisStruct = (TUserData)Marshal.PtrToStructure(pdata,typeof(TUserData)); frmEventDisplay ThisObj = (frmEventDisplay)thisStruct.ThisObj; if ((MccDaq.ErrorInfo.ErrorCode)scanError!=MccDaq.ErrorInfo.ErrorCode.TooFew) { ThisObj.DaqBoard.StopBackground(MccDaq.FunctionType.AiFunction); ThisObj.chkAutoRestart.Checked = false; } }
private void PrintADInfo(MccDaq.MccBoard pBoard) { int numADChans=0; MccDaq.ErrorInfo ULStat = pBoard.BoardConfig.GetNumAdChans(out numADChans); NumADChans[pBoard.BoardNum] = numADChans; if (numADChans != 0) Info += " Number of A/D channels: " + numADChans.ToString("0") + LF ; }
public MccPortInformation(string name, MccDaq.DigitalPortType portType, byte bitNumber) { Name = name; PortType = portType; BitNumber = bitNumber; }
private ushort GetTrigCounts(MccDaq.Range range, float EngUnits) { float fCounts; int iFSCounts; MccDaq.ErrorInfo ULStat; int FSCounts; float FSEngUnits; // check if range is bipolar or unipolar FSCounts = 0; FSEngUnits = 0.0F; ULStat = DaqBoard.ToEngUnits(range, System.Convert.ToUInt16(FSCounts), out FSEngUnits); if (FSEngUnits < 0) { // range is bipolar // check bitness FSCounts = 0XFFF; // max 12-bit value ULStat = DaqBoard.ToEngUnits(range, System.Convert.ToUInt16(FSCounts), out FSEngUnits); if (FSEngUnits < 0) { // must be 16-bit A/D FSCounts = 65535; iFSCounts = 0XFFFF; ULStat = DaqBoard.ToEngUnits(range, System.Convert.ToUInt16(iFSCounts), out FSEngUnits); } fCounts = (float)((FSCounts / 2.0F) * (1.0F + EngUnits / FSEngUnits)); } else { // range is unipolar // check bitness FSCounts = 0XFFF; // max 12-bit value ULStat = DaqBoard.ToEngUnits(range, System.Convert.ToUInt16(FSCounts), out FSEngUnits); ULStat = DaqBoard.ToEngUnits(range, System.Convert.ToUInt16(FSCounts + 0X1000), out fCounts); if (fCounts >= 2.0F * FSEngUnits) { // must be 16-bit A/D FSCounts = 65535; iFSCounts = 0XFFFF; ULStat = DaqBoard.ToEngUnits(range, System.Convert.ToUInt16(iFSCounts), out FSEngUnits); } fCounts = FSCounts * EngUnits / FSEngUnits; } if (fCounts > FSCounts) fCounts = FSCounts; if (fCounts < 0) fCounts = 0; return Convert.ToUInt16(fCounts); }