コード例 #1
0
        //get angle pitch
        public void GetDataX()
        {
            USB1.AIn(XChannelin, MccDaq.Range.Bip5Volts, out OutDataValueX);
            USB1.ToEngUnits(MccDaq.Range.Bip5Volts, OutDataValueX, out OutDataValueEngUnitsX);
            //potentiometer go`s from -95 to 265 so make it 0-360
            InputPotentiometerX = (OutDataValueEngUnitsX * 100) + 95;

            // map pitch value to degrees. 190 is 0 degrees, 360 = 10.2 degrees  0= -12,4 degrees (here is poibility to calibrate the potentiometers)
            if (InputPotentiometerX >= 190)
            {
                InputPotentiometerX = Map(InputPotentiometerX, 190, 360, 0, 10.2);
            }
            else if (InputPotentiometerX < 190)
            {
                InputPotentiometerX = Map(InputPotentiometerX, 190, 0, 0, -12.4);
            }
        }
コード例 #2
0
        public double[] ReadDyno()
        {
            //Initialize Error Handling
            ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll);

            //Create an object for board 0
            DaqBoard = new MccDaq.MccBoard(0);

            //Set the range
            Range = MccDaq.Range.Bip10Volts;

            //Put in initial values in ForceVal
            ForceVal[0] = 0;
            ForceVal[1] = 0;
            ForceVal[2] = 0;
            ForceVal[3] = 0;
            ForceVal[4] = 0;

            //read in data from DaqBoard
            DaqBoard.AIn(0, Range, out DatVal[0]);
            DaqBoard.AIn(1, Range, out DatVal[1]);
            DaqBoard.AIn(2, Range, out DatVal[2]);
            DaqBoard.AIn(3, Range, out DatVal[3]);

            //Convert data to voltage
            DaqBoard.ToEngUnits(Range, DatVal[0], out VoltVal[0]);
            DaqBoard.ToEngUnits(Range, DatVal[1], out VoltVal[1]);
            DaqBoard.ToEngUnits(Range, DatVal[2], out VoltVal[2]);
            DaqBoard.ToEngUnits(Range, DatVal[3], out VoltVal[3]);


            //New Sheet
            ForceVal[0] = 487.33 * (double)VoltVal[0];
            ForceVal[1] = 479.85 * (double)VoltVal[1];
            ForceVal[2] = 2032.52 * (double)VoltVal[2];
            ForceVal[3] = 18.91 * (double)VoltVal[3];

            return(ForceVal);
        }
コード例 #3
0
        public double ReadTempSensors()
        {
            float engunits;

            MccDaq.ErrorInfo ULStat;
            Int16            datavalue;
            int chanel = 4;

            MccDaq.Range range;
            double       TemperatureDegC;
            double       TemperatureDegF = 0;

            range = MccDaq.Range.Bip10Volts;

            ULStat = DaqBoard.AIn(chanel, range, out datavalue);

            if (ULStat.Value.Equals(MccDaq.ErrorInfo.ErrorCode.NoErrors))
            {
                DaqBoard.ToEngUnits(range, datavalue, out engunits);
                TemperatureDegC = (((datavalue - 8192) / 819.2) - 1.375) / 0.0225;
                TemperatureDegF = (TemperatureDegC * 9 / 5) + 32;
                //stil coding to continue...no clarity further
            }
            else if (ULStat.Value.Equals(MccDaq.ErrorInfo.ErrorCode.BadRange))
            {
                MessageBox.Show("Change the Range argument to one supported by this board.", ULStat.Message.ToString());
            }
            else
            {
                MessageBox.Show("Some Problem has occured with the board", ULStat.Message.ToString());
            }
            return(TemperatureDegF);
        }