void Delay_us(unsigned long delay)
{
T5CON=0;
T4CON=0;
TMR5=0;
TMR4=0;
if(delay>65536)
{
PR5 = (unsigned int)(delay>>16);
PR4 = (unsigned int)delay;
}
else
{
PR4 = (unsigned int)delay;
}
_T5IP=0x01;
_T5IF=0;
_T5IE=1;
T4CON=0x8008;
while(!_T5IF){;}
_T5IF=0;
} |