µVISION DEBUGGER: HOW CAN I LOG VARIABLE VALUES TO A FILE
http://www.keil.com/support/docs/3051.htm[2014/9/30 15:19:00]
⌂ Products Download Events Support Videos
Technical Support
Overview
Search
Contact
Assistance Request
Feedback
Support Resources
Support Knowledgebase
Article Index
Top 10 Articles
Product Manuals
Application Notes
Downloads
Product Updates
Discussion Forum
Books
Product Information
Software & Hardware
Products
ARM Development Tools
C166 Development Tools
C51 Development Tools
C251 Development Tools
Debug Adapters
Evaluation Boards
Product Brochures
Newsletters
Home / Technical Support
µVISION DEBUGGER: HOW CAN I LOG VARIABLE
VALUES TO A FILE
Information in this article applies to:
µVision Version 2 and Later
QUESTION
I run my microcontroller application in the µVision simulator andon the target debugger. This application fills an array
with data. Is it possible to write the values of this array to a file on my PC? Every time I modify my application, I want
to compare the data with the previous version.
ANSWER
Yes, this is possible. Let's assume that the application defines an array like this:
Depending on the format you need, there are many ways to log these values to a file:
Use the µVision save command to save the data in a hex file:
The file MyValues.hex then contains the values and the address information. Although viewing the values in this
file may not be easy, this hex file may be loaded back into µVision to restore the values.
You can display the values in the command window and log them to a file:
You will see the same text output in the file that was specified with the µVision LOG command (MyValues.log in
this example).
You can log the values in any other format to a file by using user defined functions in the simulator or target
debugger. The function can be invoked from the µVision command line or from a button in the toolbox.
Define a user defined function in the µVision function editor.
When the simulator is stopped, the function can be invoked in the µVision command line
unsigned char testarray[100];
save MyValues.hex &testarray[0], &testarray[99]
log > MyValues.log
d &testarray[0], &testarray[99]
0x00C240: 00 01 02 03 04 05 06 07 - 08 09 0A 0B 0C 0D 0E 0F ................
0x00C250: 10 11 12 13 14 15 16 17 - 18 19 1A 1B 1C 1D 1E 1F ................
0x00C260: 20 21 22 23 24 25 26 27 - 28 29 2A 2B 2C 2D 2E 2F !"#$%&'()*+,-./
0x00C270: 30 31 32 33 34 35 36 37 - 38 39 3A 3B 3C 3D 3E 3F 0123456789:;<=>?
0x00C280: 40 41 42 43 44 45 46 47 - 48 49 4A 4B 4C 4D 4E 4F @ABCDEFGHIJKLMNO
0x00C290: 50 51 52 53 54 55 56 57 - 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_
0x00C2A0: 60 61 62 63 'abc
log off
FUNC void displayvalues(void) {
int idx;
exec("log > MyValues.log");
for (idx = 0; idx < 100; idx++) {
printf ("testarray[idx] = %02X", idx, testarray[idx]);
}
exec("log off");
}
displayvalues() // function invocation
Important information
Don't show this message
again
Change Settings
This site uses cookies to store
information on your computer. By
continuing to use our site, you
consent to our cookies.
Search Knowledgebase
Go
Don't show this message again