#include#defineucharunsignedchar#defineuintunsignedint#defineulongunsignedlong#defineLED_DATP0sbitLED_SEG0=P2^7;sbitLED_SEG1=P2^6;sbitLED_SEG2=P2^5;sbitLED_SEG3=P2^4;#defineTIME_CYLC100//12M晶振,定时器10ms中断一次我们1秒计算一次转速//1000ms/10ms=100#definePLUS_PER10//码盘的齿数,这里假定码盘上有10个齿,即