4.8.6 The MagicScan Thread
//----------------------------------------------------------------------
// wThreadStatus : 0x01=MagicScan start
//
0x02=timeout1
//
0x04=timeout2
//
0x08=FIFO overflow
//
0x80=MagicScan OK
WORD magic_scan()
{
WORD wVal,w1,w3;
DWORD i,dwTime,j,k,dwIndex;
for (j=0; j<wMP; j++) dwMagicSum[j]=0;
for (j=0; j<wMP; j++) wMagicNow[j]=wMagicAve[j];
for (j=0; j<wMP; j++) wMagicP[j]=0;
for (i=0; i<wMP; i++) // skip the MagicScan settling time
{
dwTime=0;
for (;;)
{
wVal=inport(wAddrCtrl)&0x20;
if(wVal!=0)
break;
+;
if(dwTime>100000)
return
TimeOut;
}
inport(wAddrAdda)&0xffff;
}
dwMagicLowAlarm=0;
dwMagicHighAlarm=0;
for(i=0; i<wMagicNum; i++)
{
for (j=0; j<wMP; j++)
{
dwTime=0;
PCI-1202/1602/1800/1802 Hardware User’s Manual
(
Ver.4.2, Dec/2009, PMH-014-42)---- 78