In the SysCtlDelay documentation, you can read "The loop takes 3 cycles / loop."In simulator, it takes 4 cycles / loop.I'm wrong?
We are also using Tiva and Tivaware, but now I cannot have it.However, I suppose it presents the same problem
int main(void) { // // Setup the system clock to run at 50 Mhz from PLL with crystal reference // SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); // // Enable and configure the GPIO port for the LED operation. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED); // // Loop Forever // while(1) { // // Turn on the LED // GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, RED_LED); AL = 1; // // Delay for a bit // SysCtlDelay(2000000); // // Turn on the LED // GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, BLUE_LED); AL = 0; // // Delay for a bit // SysCtlDelay(2000000); } }
Again, that's TI's software - so you should be asking them about it, and/or for clarifications on their documentation!
By measuring the switching time of the port with an oscilloscope, it is confirmed that Delay actually occupies 3 cycles / loop.And in the simulation 4 cycles / loop.