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.

TM4C123GH6PM: Interrupt Priority

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C1294XL

Hello,

I have a two part question. What would be the best way to get the most accurate delay? 

I am currently using a nested for loop but it seems like its off some. I have my loop as is below. Assuming the 16 Mhz CPU Clock.

void milliDelay(int t)

{

     int x, y;

     for(x = 0; x < t; x++)

           for(y = 0; y < 3180; y++)

           {}

}

Second question is how do i properly utilize the Interrupt Priority? I am reading page 153 of the TM4c Data Sheet and it doesnt explain much other than it holds a 0-7 priority value. What is that in reference to?

I understand the Pri0, Pri1 Etc. but not sure how to set the priority of the interrupt.

Lets say I want to use port E's interrupt. That would be (interrupt enable) EN0 and Pri1.

How and why does the priority come into play? And what priority is it comparing itself to?

  • I am currently using a nested for loop but it seems like its off some. I have my loop as is below. Assuming the 16 Mhz CPU Clock.

    void milliDelay(int t)

    {

         int x, y;

         for(x = 0; x < t; x++)

               for(y = 0; y < 3180; y++)

               {}

    }

    Why don't you SysCtlDelay(). If you put call SysCtlDelay(1) then it take three CPU cycles to execute. If you SysCtlDelay(16000000 / 3) then it will give you one second of delay. 

    I understand the Pri0, Pri1 Etc. but not sure how to set the priority of the interrupt.

    Lets say I want to use port E's interrupt. That would be (interrupt enable) EN0 and Pri1.

    How and why does the priority come into play? And what priority is it comparing itself

    You can use IntPrioritySet() to configure for different interrupt priority. Also refer to C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\interrupts\interrupts.c example. This example illustrates how to configure different GPIO ports for different priority using IntPrioritySet().