This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

related to sysctldelay

Hi,

I am new to use ccs. I am getting problem with sysctldelay API. I have set clock as  (SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ)). after that i used sysctldelay(1000), do i get a 1000 ms delay? or does it take 3000 cycles to execute?

pls help me out with this.

Thanks in advance.

Regards.

  • Ankeet,

    It will take 3000 cycles. Do the maths of how much time that is at 16 MHz.

    SysCtlDelay is not exact... it is not a good solution if you need precise timing. It is fine if you need to wait "around some time", in which case a commom practice is to create a constant that holds the amount of cycles for 1ms, and then maybe call SysCtlDelay(cycles1ms * 1000) to make easy reading... But still there is nothing precise about this, and it is useful only during "learning phase", for the constant can't adapt to different clocks.

    ROM_SysCtlDelay() will in theory be a bit better... But then again, interrupts and other diversions can completely mess up the time it takes. So when you are ready for better timing control, start playing with timers.