Time in uS to Execute

Discussion in 'Embedded Systems and Microcontrollers' started by T.Jackson, Dec 4, 2011.

  1. T.Jackson

    Thread Starter New Member

    Nov 22, 2011
    mikroC question:

    Does anyone have any idea as to how long: i = UART1_Read(); -- takes to execute on a 20MHz / 5MIPS PIC MCU?
  2. DerStrom8

    Well-Known Member

    Feb 20, 2011
    Are you using MPLAB? If you are, I'd suggest you use MPLAB SIM and the stopwatch feature. Put a breakpoint right before the command and right after it. Run to the first BP, reset the stopwatch, run until it reaches the next BP, and read the stopwatch. It should tell you how many instruction cycles it used and how long it took. Make sure your debugger settings are set to the right values, though (i.e. frequency, etc).
  3. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    Did you not read my reply in your original thread? It greatly depends on you compiler, the USART driver library implementation, and the availability of incoming data:

  4. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    Further, from where do you get the expectation that each call to UART1_Read() will consume a consistent number of instruction cycles?