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.

TM4C123G While loop time calculations

Other Parts Discussed in Thread: TM4C123GH6PGE

Hi there,

I am working on my Lab assignment for displaying internal temp sensor on 96×64 color OLED. I am using TM4C123G USB+CAN Development Kit  with Tiva TM4C123GH6PGE MCU. My project is working fine , but there is one problem that displayed temperature should update every 500ms. So I have to calculate the timing for while loop or in other words I need to tune while loop's one iteration to 500ms. I am using CCS v6 compiler. Is there any way to calculate it in compiler itself ? or what is the best way ?      

  • Hello Harpreet,

    The best way is to use the SysTick or a General Purpose Timer to generate an interrupt every 500ms and then use this as a reference for update to the screen

    Regards
    Amit
  • And - if you don't wish to torment your user/viewers w/least significant digit "bounce/jitter" - you may wish to read the sensor at a higher rate (perhaps 8 times higher) and then present that (averaged) reading at your desired 500mS intervals.

    As you report your project to be, "working fine" we suspect that your binary to decimal decoding (so that the output to the OLED makes sense to humans) would prove of value to many here.   (most will - at some point - be challenged w/that identical task...)    This is your chance to "repay" the kindness shown to you by others...

    For "extra credit" describe why "8 sensor reads" - and not 10 reads - was chosen...