SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
User avatar
By leon_heller
#75903
What do you mean by "execution time"?

Leon
By naz
#75905
i'm using two functions for transmitting and receiving,i want to know the total time of the program.
User avatar
By leon_heller
#75907
Using a simulator is one way, or you could count the instruction cycles manually. You can also output a signal before and after the relevant piece of code and check the time with a scope. I've used all those techniques.

Leon
By OldCow
#75932
If the code includes polling IFGs or waiting for ISRs, counting cycles is not easy to do. Use a scope is more practical.

If you use serial communication for transmitting and receiving data, the bit-rate and the amount of data probably dominate the total execution time. But floating-point calculations, printf(), and stuff like that can add a lot of extra time too.
By steveduck
#78158
Naz,
set up timer_a to clock from either ACLK or SMCLK, start running and you can initialise a capture channel which can be software triggered. Capture timer_a counts at the start and then end of your comms routine to get the delta_t. you will need to make sure that the resolution of the time base is in the right range.

Another way is to re direct the SMCLK or ACLK to the port pins during the communications stuff and count using a frequency counter to determine OSC ticks so you can relate to time or measure pulse length as per Leons suggestion.

Steve