Delay is twice that of Keil and Proteus simulator

Thread Starter

Tera-Scale

Joined Jan 1, 2011
164
I am using a timer delay with polling method. Every thing works fine execpt that when implementend on my dev board, the true delay is twice that of Keil and Proteus simulator. Every crystal frequency setting is correct. Any ideas. I tried to check the X2 in the hardware byte option
in flip but then my UART communication was effected and did not work correctly because of the baud rate being doubled. I had to vary the baud rate on my PC and then it worked fine. Is there any other solution for this problem?

Rich (BB code):
void delay_10m()			// Delay generation using Timer 0 mode 1
{
	TMOD = 0x01;			// Mode1 of Timer0
	TH0= 0xC3;  			// C33FF = 10millisecond delay
	TL0 = 0xFF;
	TR0 = 1;   				// Start Timer
	while(TF0 == 0); 		// Polling method
	TR0 = 0; 				// Stop Timer
	TF0 = 0; 				// Clear flag
}

ucont : T89C51AC2
XTAL : 18.432Mhz
Keil: Uvision V4.60.00.0
 
Top