1. 首页
  2. 编程语言
  3. 硬件开发
  4. MST线性值计算器_V1.3.exe

MST线性值计算器_V1.3.exe

上传者: 2018-12-27 14:50:57上传 EXE文件 425KB 热度 58次
MST模拟量线性计算工具,个人制作。 BYTE usrNonLinearCalculate(NonLinearCurveType NoLinear,BYTE AdjustValue) { //dual direction BYTE rValue,ucXVStart,ucXVEnd,ucXStar,ucXEnd,ucStartPoint; WORD wDistance; BYTE temData = AdjustValue; if (AdjustValue < NON_LINEAR_POINT_X1) { ucXVStart = NoLinear.X0; ucXVEnd = NoLinear.X1; ucXStar = NON_LINEAR_POINT_X0; ucXEnd = NON_LINEAR_POINT_X1; } else if (AdjustValue < NON_LINEAR_POINT_X2) { ucXVStart = NoLinear.X1 ; ucXVEnd = NoLinear.X2; ucXStar = NON_LINEAR_POINT_X1; ucXEnd = NON_LINEAR_POINT_X2; } else if (AdjustValue < NON_LINEAR_POINT_X3) { ucXVStart = NoLinear.X2; ucXVEnd = NoLinear.X3; ucXStar = NON_LINEAR_POINT_X2; ucXEnd = NON_LINEAR_POINT_X3; } else { ucXVStart = NoLinear.X3; ucXVEnd = NoLinear.X4; ucXStar = NON_LINEAR_POINT_X3; ucXEnd = NON_LINEAR_POINT_X4; } if (ucXVEnd > ucXVStart) { wDistance = ucXVEnd - ucXVStart; ucStartPoint = ucXVStart; temData = AdjustValue - ucXStar; } else { wDistance = ucXVStart - ucXVEnd; ucStartPoint = ucXVEnd; temData = ucXEnd - AdjustValue; } rValue = ((WORD)wDistance*temData/(ucXEnd - ucXStar)) + ucStartPoint; return rValue; } ; ucXVEnd = NoLinear.X2; ucXStar = NON_LINEAR_POINT_X1; ucXEnd = NON_LINEAR_POINT_X2; } else if (AdjustValue < NON_LINEAR_POINT_X3) { ucXVStart = NoLinear.X2; ucXVEnd = NoLinear.X3; ucXStar = NON_LINEAR_POINT_X2; ucXEnd = NON_LINEAR_POINT_X3; } else { ucXVStart = NoLinear.X3; ucXVEnd = NoLinear.X4; ucXStar = NON_LINEAR_POINT_X3; ucXEnd = NON_LINEAR_POINT_X4; } if (ucXVEnd > ucXVStart) { wDistance = ucXVEnd - ucXVStart; ucStartPoint = ucXVStart; temData = AdjustValue - ucXStar; } else { wDistance = ucXVStart - ucXVEnd; ucStartPoint = ucXVEnd; temData = ucXEnd - AdjustValue; } rValue = ((WORD)wDistance*temData/(ucXEnd - ucXStar)) + ucStartPoint; return rValue; }
用户评论