PCI-1202/1602/180x Series Card
Multi-Function Boards
User Manual/ Ver. 4.8/ Mar. 2015/ PMH-0014-48/ Page: 99
if (w1==0)
{
wVal=(WORD)(dwMagicSum[j]/wMagicAve[j]);
if (wMagicScanSave[j]==1)
{
*((wMagicScanBuf[j])+wMagicP[j])=wVal;
wMagicP[j]++;
}
w3=wMagicAlarmType[j];
if(w3>0)
// 0 = no alarm
{
dwIndex=0x01; k=j;
while (k>0)
{
dwIndex=dwIndex<<1;
k--;
}
if (w3==2)
// 2 = low alarm
{
if (wVal<wMagicLowAlarm[j]) dwMagicLowAlarm |= dwIndex;
}
else if (w3==1)
// 1 = high alarm
{
if (wVal>wMagicHighAlarm[j]) dwMagicHighAlarm |= dwIndex;
}
else if (w3==4)
// 4 = high or low alarm
{
if (wVal<wMagicLowAlarm[j]) dwMagicLowAlarm |= dwIndex;
if (wVal>wMagicHighAlarm[j]) dwMagicHighAlarm |= dwIndex;
}
else if (w3==3)
// 3 = in [low,high] alarm
{
if ((wVal>wMagicLowAlarm[j])&& (wVal<wMagicHighAlarm[j]))
{
dwMagicLowAlarm |= dwIndex;
dwMagicHighAlarm |= dwIndex;
}
}
}
dwMagicSum[j]=0;
wMagicNow[j]=wMagicAve[j];
}
// end if(w1
}
// end for(j=
}
// end for(i=
ret_label:
disable_timer0();
return 0;
}