ag IE0=0; } uchar KeyScan() { uchar keyValue=0; if( (Key & 0x0F)!=0x0F ){ keyValue = Key & 0x0F; delay1ms(20); if(keyValue == (Key & 0x0F)) /* Confirm Key Pressing */{ keyVal = keyValue; return 1; } else return 0; /* No Key Pressing */ } return 0; } void delay1ms(unsigned T) //?? 0us { unsigned char a,b; while(T--) for(b=39;b>0;b--) for(a=1;a>0;a--); } ulong Mean(ulong* Array) { char i,j; ulong temp,sum=0; for(i=0;i<19;i++) for(j=0;j<19;j++) { if(Array[j]>Array[j+1]) { temp = Array[j]; Array[j]=Array[j+1]; Array[j+1]=temp; }} /* end sort */ for(i=5;i<15;i++) sum += Array[i]; return sum/10; } char stable(ulong * Array) { ulong max=*Array,min=*Array; char i; for(i=0;i<20;i++) { if(Array[i]>max) max=Array[i]; if(Array[i]<min) min=Array[i]; } if(max-min<150) return 1; return 0; } 附录三元器件清单元器件清单