protected bool WriteFixedLosValue(DUT dut) { bool isWriteOk = dut.WriteLOSDac(adjustLosStruct.LosAVoltageStartValue); bool isStoreOk = dut.StoreLOSDac(adjustLosStruct.LosAVoltageStartValue); bool isWriteOk1 = dut.WriteLOSDDac(adjustLosStruct.LosAVoltageStartValue); bool isStoreOk1 = dut.StoreLOSDDac(adjustLosStruct.LosAVoltageStartValue); Thread.Sleep(100); targetLosADac = adjustLosStruct.LosAVoltageStartValue; targetLosDDac = adjustLosStruct.LosDVoltageStartValue; return(isWriteOk && isStoreOk && isWriteOk1 && isStoreOk1); }
protected bool OneSectionMethodLosDAdjust(UInt32 startValue, byte step, UInt32 uperLimit, UInt32 lowLimit, DUT dut, byte tolerenceStep, out UInt32 targetLosDac) { byte adjustCount = 0; byte backUpCount = 0; bool isLos = false; byte tempTolerenceStep = tolerenceStep; tolerenceStep = Convert.ToByte(Math.Floor(Math.Log(Convert.ToDouble(tempTolerenceStep), 2))); byte totalExponentiationCount = Convert.ToByte(Math.Floor(Math.Log(Convert.ToDouble(step), 2))); do { if (startValue > uperLimit) { startValue = uperLimit; } else if (startValue < lowLimit) { startValue = lowLimit; } dut.WriteLOSDac(startValue); Thread.Sleep(500); dut.StoreLOSDac(algorithm.Uint16DataConvertoBytes(Convert.ToUInt16(startValue))); Thread.Sleep(1000); isLos = dut.ChkRxLos(); Thread.Sleep(1000); isLos = dut.ChkRxLos(); if ((isLos == true)) { int tempValue = (int)(startValue + (UInt32)Math.Pow(2, totalExponentiationCount - backUpCount) >= 4294967295 ? 4294967295 : startValue + (UInt32)Math.Pow(2, totalExponentiationCount - backUpCount)); startValue = (UInt32)tempValue; } else if ((isLos == false) && ((totalExponentiationCount - backUpCount + 1) > tolerenceStep)) { int tempValue = (int)((startValue - (UInt32)Math.Pow(2, totalExponentiationCount - backUpCount)) >= 0 ? (startValue - (UInt32)Math.Pow(2, totalExponentiationCount - backUpCount)) : 0); startValue = (UInt32)tempValue; backUpCount++; tempValue = (int)((startValue + (UInt32)Math.Pow(2, totalExponentiationCount - backUpCount)) >= 4294967295 ? 4294967295 : (startValue + (UInt32)Math.Pow(2, totalExponentiationCount - backUpCount))); startValue = (UInt32)tempValue; } if (isLos == true || (totalExponentiationCount - backUpCount + 1) >= tolerenceStep) { adjustCount++; } } while (adjustCount <= 30 && (isLos == true || (totalExponentiationCount - backUpCount + 1) > tolerenceStep)); targetLosDac = startValue; return(isLos == false); }
protected bool OneSectionMethodLosAdjust(double startValue, byte step, double uperLimit, double lowLimit, DUT dut, out double targetLosDac) { byte adjustCount = 0; bool isLos = false; byte totalExponentiationCount = Convert.ToByte(Math.Floor(Math.Log(Convert.ToDouble(step), 2))); do { if (startValue > uperLimit) { startValue = uperLimit; } else if (startValue < lowLimit) { startValue = lowLimit; } dut.WriteLOSDac(startValue); dut.StoreLOSDac(startValue); Thread.Sleep(100); isLos = dut.ChkRxLos(); Thread.Sleep(50); isLos = dut.ChkRxLos(); if ((isLos == false)) { UInt32 tempValue = (UInt32)(startValue + (UInt32)Math.Pow(2, totalExponentiationCount) >= uperLimit ? uperLimit : startValue + (UInt32)Math.Pow(2, totalExponentiationCount)); startValue = (UInt32)tempValue; } if (isLos == false) { adjustCount++; } } while (adjustCount <= 30 && (isLos == false)); targetLosDac = Convert.ToUInt32(startValue); return(isLos); }
protected bool LosAEqualLosDAdjust(UInt32 startValue, byte step, UInt32 uperLimit, UInt32 lowLimit, DUT dut, byte tolerenceStep, out UInt32 targetLosDac) { dut.WriteLOSDac(startValue); targetLosDac = startValue; return(true); }