mess Posted August 13, 2006 Report Share Posted August 13, 2006 Hello,how can I measure the processor load of my code?I'm working on a seq based on clockbox so I tried to display the number of clock countersthat need to be processed each tickbut the numbers vary too fast to see any result...Is there a simulator for the 18F series? With the µVision IDE at school you can run your program in simulation to see the runtime of each procedure,I find such a feature very useful to find bottlenecks in C code... Quote Link to comment Share on other sites More sharing options...
TK. Posted August 13, 2006 Report Share Posted August 13, 2006 Hi,I'm normaly using my scope to measure the performance. A free IO pin is set to 1 when the function starts, and to 0 when it is finished - it gives a good feeling about the processor load. In addition, the scope can display the minimum and maximum pulsewidth.However, w/o a scope it gets difficult. You could use the integrated simulator of MPLAB, but it requires that you call the function which should be profiled with a correctly initialized memory. Since it is difficult to combine MIOS with the application in order to simulate it completely, you have to add some debugging code, located at 0x0000 (reset vector), which inits the memory and jumps to USER_Tick (not to Tick()) - this ensures, that also the stack pointers are initialized correctlyThis debugging code must be removed when you want to upload the application again.Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
mess Posted August 13, 2006 Author Report Share Posted August 13, 2006 Ok I will try the scope methodmy seq works but the timing is not so stable at the moment... Quote Link to comment Share on other sites More sharing options...
stryd_one Posted August 14, 2006 Report Share Posted August 14, 2006 hi mess... I thought that might happen when I saw the code... I have picked up a few tips about realtime operation along the way, so just let me know if you want some advice .... but I think you're probably OK without my help :) Quote Link to comment Share on other sites More sharing options...
mess Posted August 14, 2006 Author Report Share Posted August 14, 2006 Hi Stryd,In the meanwhile most of my code is rewritten, so I will PM you a new version this evening.My main goal at the moment is to implement the CS and some basic features without optimising any code...(this should be done in a few days)When the CS is done it's optimisation time :-)I've done some simple realtime stuff in the past with a 8051 based school projectsee this link (it's a pong game with a propellor display):http://users.skynet.be/sky92755/pongwerkt.mov (20MB), note that the image doesn't look stable because of my crappy cameraI found it easier to modify the asm output from the Keil compiler than the gcc compiler...Maybe I should work on my pic18 assembler knowledge a bit, it's a lot more complicatedthen 8051 asmAny help is REALLY welcome, I'm looking forward to completing this project as soon as possible :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.