void delay(int delay, char degree = 'm')
{
int cntr;
if(degree == 'm' || degree == 'M')
{
// Our timing configuration is in milli-seconds
OVF = 0;
T3CON |= 0x80; // 16-bit configuration set
for(cntr = 0; cntr < delay; cntr++)
{
// Load TMR3H and TMR3L bytes
TMR3H = (63536 >> 8) & 0xFF; // Load TMR3H byte first
TMR3L = 63536 & 0xFF; // Load TMR3L byte next
while(!OVF); // Wait for timer to complete transaction
OVF = 0;
}
}
else if(degree == 's' || degree == 'S')
{
// Our timing configuration is in seconds
OVF = 0;
T3CON |= 0x80; // 16-bit configuration set
for(cntr = 0; cntr < (delay * 2); cntr++)
{
// Load TMR3H and TMR3L bytes
TMR3H = (64536 >> 8) & 0xFF; // Load TMR3H byte first
TMR3L = 64536 & 0xFF; // Load TMR3L byte next
while(!OVF); // Wait for timer to complete transaction
OVF = 0;
}
}
}