This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Speed difference between the target and the simulator

I'm trying to toggle an output pin but I have some timing differences between simulator and the target.
The following code is reporting me a factor of two between the simulator speed and the target (the simulator is faster than the what I'm measuring with an oscilloscope).

while (1 == 1)
{
LCD_RW = 0;
delay_xxms ();
LCD_RW = 1;
delay_xxms ();
}

void delay_xxms (void)
{
unsigned long int i, j;

for (j = 0; j < 0x0206; j ++)
{
for (i = 0; i < 0x00FA; i ++)
{
_nop_ ();
}
}
}

But! If I'm using a timer interrupt, I have the SAME timing on the target and the simulator (no other interrupts are enabled).

void LCD_timer (void) interrupt 0x0024
{
/* stop timer */
GPT12E_T4CON_T4R = 0;
if (LCD_RS == 0)
{
LCD_RS = 1;
}
else
{
LCD_RS = 0;
}
GPT12E_T4 = 0x00C8; /* supposed that f = 8 MHz and BPS = 00b (value after reset) */
/* clear timer flag */
GPT12E_T4IC_IR = 0;
/* start timer */
GPT12E_T4CON_T4R = 1;
}

I'm using the Infineon XC164 Controller and uVision 3 simulator. The quartz frequency in the simulator is 8MHZ, the same on the target. I have the PLL bypassed; PLLIDIV = 0, PLLODIV = 0, CPSYS = 0, no change if (WSRAM = 0 or WSRAM = 1), or if (WSFLASH = 00 or WSFLASH = 01)

What is happening here?

0