You are on page 1of 10

2014/11/13, 14:00:13 @void _CheckAdcValue(int* pnErr, char* sErrMsg)

{
static int nReported = 0;
##if (1)
if ((nReported & 1) == 0) {
##if (1) // AC
if ((inAry[0] < -1.5) || (inAry[0] > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A0 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((inAry[0] < 0.0) || (inAry[0] > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A0 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 1;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 2) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A1 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A1 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 2;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 4) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A2 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A2 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 4;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 8) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A3 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A3 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 8;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 16) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A4 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A4 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 16;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 32) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A5 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A5 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 32;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 64) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A6 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A6 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 64;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 128) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A7 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel A7 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 128;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 256) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B0 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B0 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 256;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 512) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B1 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B1 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 512;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 1024) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B2 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B2 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 1024;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 2048) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B3 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B3 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 2048;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 4096) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B4 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B4 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 4096;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 8192) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B5 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B5 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 8192;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 16384) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B6 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B6 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 16384;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
##if (0)
if ((nReported & 32768) == 0) {
##if (1) // AC
if ((0.0 < -1.5) || (0.0 > 1.5)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B7 of the A/D
converter is over the range of -1.5V to +1.5V. It will be limited to the limit.");
##else
if ((0.0 < 0.0) || (0.0 > 3.0)) {
strcpy(sErrMsg, "Warning! The input signal of Channel B7 of the A/D
converter is over the range of 0 to +3V. It will be limited to the limit.");
##endif
*pnErr = -10;
nReported |= 32768;
if ((nReported & 0x40000) == 0) {
nReported |= 0x40000;
strcat(sErrMsg, "\n\nWarning! The input signal of ADC is over the
range!");
}
return;
}
}
##endif
}

2014/11/13, 14:00:13 @void _SetDoValue5(int bRoutine, int nNo, DefaultType fVal)


{
static DefaultType oldVal[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};

if (bRoutine) {
##if (1)
outAry[0] = oldVal[0];
##endif
##if (1)
outAry[1] = oldVal[1];
##endif
##if (1)
outAry[2] = oldVal[2];
##endif
##if (1)
outAry[3] = oldVal[3];
##endif
##if (0)
0.0 = oldVal[4];
##endif
##if (0)
0.0 = oldVal[5];
##endif
##if (0)
0.0 = oldVal[6];
##endif
##if (0)
0.0 = oldVal[7];
##endif
} else {
oldVal[nNo] = fVal;
}
}

2014/11/13, 14:00:13 @void _SetVP12(int bRoutine, DefaultType fVal)


{
static DefaultType val = 0.0;
if (bRoutine) {
val = fVal;
}
outAry[4] = val;
}

2014/11/13, 14:00:13 @##if (0 == 0)


##if (1) // AC
(inAry[0] > 1.5 ? 1.5 : (inAry[0] < -1.5 ? -1.5 : inAry[0])) * (1.0/1.4);
##else // DC
(inAry[0] > 3.0 ? 3.0 : (inAry[0] < 0.0 ? 0.0 : inAry[0])) * (1.0/1.4);
##endif
##elseif (0 == 1)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 2)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 3)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 4)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 5)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 6)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 7)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 8)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 9)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 10)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 11)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 12)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 13)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 14)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##elseif (0 == 15)
##if (1) // AC
(0.0 > 1.5 ? 1.5 : (0.0 < -1.5 ? -1.5 : 0.0)) * 1.0;
##else // DC
(0.0 > 3.0 ? 3.0 : (0.0 < 0.0 ? 0.0 : 0.0)) * 1.0;
##endif
##endif

2014/11/13, 14:00:13 @fTI_ADC1;


2014/11/13, 14:00:13 @0.1;
2014/11/13, 14:00:13 @##if ((1 == 1) && ((-1) == 1))
fZOH1 + fajuste;
##elseif ((1 == 1) && ((-1) == -1))
fZOH1 - fajuste;
##else
fZOH1 * 1 + fajuste * (-1);
##endif
2014/11/13, 14:00:13 @42.205;
2014/11/13, 14:00:13 @sin(falfa * (3.14159265 / 180.));
2014/11/13, 14:00:13 @(fSUM1 > fSIN1) ? 1 : 0;
2014/11/13, 14:00:13 @180+42.205;
2014/11/13, 14:00:13 @sin(f180alfa * (3.14159265 / 180.));
2014/11/13, 14:00:13 @##if ((1 == 1) && ((-1) == 1))
fZOH1 + fajuste;
##elseif ((1 == 1) && ((-1) == -1))
fZOH1 - fajuste;
##else
fZOH1 * 1 + fajuste * (-1);
##endif
2014/11/13, 14:00:13 @(fSIN2 > fSUM1) ? 1 : 0;
2014/11/13, 14:00:13 @(fSUM1 > fSIN1) ? 1 : 0;
2014/11/13, 14:00:13 @(fSIN2 > fSUM1) ? 1 : 0;
2014/11/13, 14:00:13 @_SetDoValue5(0, 0, (fCOMP1 >= 1.0) ? 1 : 0);
_SetDoValue5(0, 1, (fCOMP2 >= 1.0) ? 1 : 0);
_SetDoValue5(0, 2, (fCOMP1 >= 1.0) ? 1 : 0);
_SetDoValue5(0, 3, (fCOMP2 >= 1.0) ? 1 : 0);

2014/11/13, 14:00:13 @##if ((1 == 1) && ((-1) == 1))


fZOH1 + fajuste;
##elseif ((1 == 1) && ((-1) == -1))
fZOH1 - fajuste;
##else
fZOH1 * 1 + fajuste * (-1);
##endif
2014/11/13, 14:00:13 @_SetVP12(1, fSUM1);
2014/11/13, 14:00:13 @

You might also like