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