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.

RM44L920: Time delay

Part Number: RM44L920
Other Parts Discussed in Thread: HALCOGEN

I need to implement time delay without software dealy such as count in for loop.how to implement?

  • Hi Karthik,

    One simple way is, you can use RTI peripheral to create delay.

    Example:

    If i want to create 5sec delay in the code using RTI peripheral, then 

    1. First i need to configure the required delay in msec(5000) to compare0 of the RTI

    2. Once you configure required delay you can just generate the code by enabling the RTI driver in HALCoGen.

    3. Now in the code you just need to start the counter and poll the rtiNOTIFICATION_COMPARE0 flag until it get sets.

    Once flag got set you can just stop the counter and again start the counter whenever you want to create the delay gain.

    Here is an example project you can refer, which is built and test it on RM57

    TimeDelay_Example_RM57.zip

    --

    Thanks & regards,
    Jagadish.

  • I used the above code but while debugging it gets stuck at while loop. even my delay is less than 1 second also

  • Hi Karthik,

    I used the above code but while debugging it gets stuck at while loop. even my delay is less than 1 second also

    As you configured less than 1 second maybe you can't see the delay 

    actually, it will wait get wait for configured delay in below highlighted lines of the code, once the delay completed it will wait at while(1).

    If you want to create repeated delay than you can change code as below

    in this case a repeated configured delay will get created at below line of the code

    while(!(rtiREG1->INTFLAG & rtiNOTIFICATION_COMPARE0)); //wait until the delay configured for compare0

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagdish,

    I dont need repeated delay , i need a global delay for once only , and ill tell you what are all the things done .

    i am using one counter block for repeated delay & another one for global delay(once).

  • I dont need repeated delay , i need a global delay for once only

    In that case use code as below

    Here the configured delay will get created only one time at the highlighted line.

    --

    Thanks & regards,
    Jagadish.