Go to Post FIRST is not really located in Manchester NH but with each student and mentor involved - UCGL_Guy [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Spotlight this post!  
Unread 09-02-2004, 09:01
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,856
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to measure execution time? And code size?

Quote:
Originally Posted by gnormhurst
Can someone describe a simple way to measure how much of the 26 ms time budget is being used? As I add code I would like to know how close I am coming to the limit.

Also, how do I know how close I am to the memory limits for code and data?

Thanks all,
Norm
For the timing I set an internal timer and initialize the timer at the start and read it when it comes around again. You can use clock ticks or convert it to ms. I wouldn't use the MPLAB SIM for this.
For the default code you get 112,840 to 112,892 loops per second or ~42 (THE_ANSWER) ticks per loop for the basic default program (results may vary).

There are a couple of ways to check memory utilization.
1) When you open the .hex file in the IFI_Loader there is a text string at the bottom of the IFI_Loader window that tells you how much space the .hex file uses. For instance, the FRC default code will show:
"Total Bytes 2C90, Erase Size B5, Flash 800-3510, MemSize 2D10"

2)A memory map can be generated by MPLAB whenever you compile your code. You have to turn it on by going to Project -> Build Options... -> Project then click on the "MPLINK Linker" tab, then click on "Generater map file". After you build your project look in the project directory for a text file ending in ".map" just a little way down the file it will have a section that looks like:
Code:
                              Program Memory Usage 
                               Start         End      
                           ---------   ---------      
                            0x000800    0x000837      
                            0x0008d4    0x0033d8      
                            0x0033da    0x003511      
                            0x300000    0x30000d      
            11395 out of 33816 program addresses used, program memory utilization is 33%
This gives you the program or rom space used. For the data or ram space it's a little harder. After the section above all space used will be listed by address. You'll see your familiar variables listed. You have to check the maximum addresses used by the data portion of your code.
Code:
e.g.,
    I   0x0007b7       data     static C:\mcc18\Projects\FrcCode\FrcCode\ifi_library.c
count   0x0007b8       data     static C:\mcc18\Projects\FrcCode\FrcCode\ifi_library.c
 temp   0x0007b9       data     static C:\mcc18\Projects\FrcCode\FrcCode\ifi_library.c
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 09-02-2004 at 11:17.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Interrupt timer, executing code asap? SeanCassidy Programming 10 07-03-2004 01:47
Actual execution time measurement Dan Technical Discussion 5 24-03-2003 11:36
Autonomous Code From Experience EbonySeraphim Programming 7 14-03-2003 21:56
Ok one problem cantwell03 Programming 3 13-02-2003 07:28
Solution to Timing Loops Steven Carmain Programming 39 10-02-2003 13:33


All times are GMT -5. The time now is 00:03.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi