Times various internal functions and code sections
The uProfiler is a hardware based profiler that you can use to debug your uController project.
This profiler connects to your PC via USB, and apears as a CDC Serial port.
Connect to this serial device with an ANSI Color terminal.
I had been using a few pins connected to my scopes to measure pulse widths so I could
measure various loops and functions, and sending debug info into a terminal.
Then I saw the code profiler built into CCS C compiler, I tried to reverse it a bit, as I didnt have
their ICSP programmer. Then I just decided to dive in and put something together that would not
tie down the PIC, and something I could remove from source very easily.
Checkout the usage.txt file listed on the right.
In your code, include the uprofiler.h file, and insert various pieces of code into your source
and you can debug the following:
- Determine main loop running time
- Time various functions (up to 16)
- Time various sections of code (up to 16)
- View up to 16x 8 bit variables or 8x 16bit variables
- Inc/Clear 15 counters
- Set and Clear 16 flags
- Turn on/off 5 LED's (also displays on screen
- Set a State output (useful for state machines or status)
All this with very little impact on your C source code. All measurements are done in
the uProfiler, as well as all the ANSI color output. Just connect to an ANSI Serial terminal.
We take the generaly unused pin B7 (Microchip uControllers)
and create a BitBang'd serial output from it, and use that to feed
The overhead your C program incures is minimal, just the time it takes to
bitbang 1 byte for most of the profiler functions.
Exceptions are viewing variables, that sends 3 bytes for 8bit, and 6 bytes for 16bit.
It is easily possible to modify the header file, and use a hardware UART to lower the impact.
Note: Great pains were taken to tune the timming functions within the uProfiler. We are accurate
to within +/- 15us. Now I know that a super critical loop can be lower than this. If you need
super accurate timming, please, use a dedicated pin and a scope.
Note 2.0: There may be a pin timing input on this project in the very near future
Here is an example:
#define UPROFILER_BAUD 19200
unsigned int16 x,y,z;
z = x/y;
| Project Specs|
|sw ver: ||1.1|
|compiler: ||CCS C|
|All Caps: ||.01uF|