예제 #1
0
        protected UInt32 EnumMethod(UInt32[] inPutArray, DUT dut, ErrorDetector ed, byte substep, out ArrayList berArray, out ArrayList apdDacArray, out double minBer)
        {
            berArray    = new ArrayList();
            apdDacArray = new ArrayList();
            UInt32 minimumDAC;

            for (byte i = 0; i < inPutArray.Length; i++)
            {
                // add write APD
                dut.WriteAPDDac(inPutArray[i]);
                apdDacArray.Add(inPutArray[i]);
                ed.GetErrorRate();
                berArray.Add(ed.GetErrorRate());
            }

            minBer = -1;
            byte minIndex = 0;

            #region Select minimum value
            minBer     = Algorithm.SelectMinValue(berArray, out minIndex);
            minimumDAC = inPutArray[minIndex];
            #endregion

            #region Fine Tune Target Value
            dut.WriteAPDDac(Algorithm.Uint16DataConvertoBytes((UInt16)(inPutArray[minIndex] + substep)));

            double tempBer1 = ed.GetErrorRate();
            dut.WriteAPDDac(Algorithm.Uint16DataConvertoBytes((UInt16)(inPutArray[minIndex] - substep)));
            double tempBer2   = ed.GetErrorRate();
            double mintempBer = Math.Min(tempBer1, tempBer2);
            if (mintempBer == tempBer1)
            {
                if (minBer > tempBer1)
                {
                    minimumDAC = Convert.ToUInt16(minimumDAC + substep);
                    apdDacArray.Add(minimumDAC);
                    dut.WriteAPDDac(minimumDAC);
                    minBer = ed.GetErrorRate();
                    berArray.Add(minBer);
                }
            }
            else
            {
                if (minBer > tempBer2)
                {
                    minimumDAC = Convert.ToUInt16(minimumDAC - substep);
                    apdDacArray.Add(minimumDAC);
                    dut.WriteAPDDac(minimumDAC);
                    minBer = ed.GetErrorRate();
                    berArray.Add(minBer);
                }
            }


            #endregion
            return(minimumDAC);
        }