Information in this article applies to:
I run my microcontroller application in the μVisionsimulator andon the target debugger. This application fills an arraywith data. Is it possible to write the values of this array to a fileon my PC? Every time I modify my application, I want to compare thedata with the previous version.
Yes, this is possible. Let's assume that the application definesan array like this:
unsigned char testarray[100];
Depending on the format you need, there are many ways to log thesevalues to a file:
save MyValues.hex &testarray[0], &testarray[99]
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.
log > MyValues.logd &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 @ABCDEFGHIJKLMNO0x00C290: 50 51 52 53 54 55 56 57 - 58 59 5A 5B 5C 5D 5E 5F PQRSTUVWXYZ[\]^_0x00C2A0: 60 61 62 63 'abclog offYou will see the same text output in the file that wasspecified with the μVision LOG command (MyValues.log in thisexample).
Define a user defined function in the μVision function editor.
FUNC void displayvalues(void) { int idx; exec("log > MyValues.log"); for (idx = 0; idx < 100; idx++) { printf ("testarray[idx] = %02X\n", idx, testarray[idx]); } exec("log off");}
When the simulator is stopped, the function can be invoked in the μVision command line
displayvalues() // function invocationor you can define a button in the toolbox to start the function
define button "Log Array", "displayvalues()"
The values can be viewed in the command window and they are logged to the specified file:
testarray[idx] = 00testarray[idx] = 01testarray[idx] = 02testarray[idx] = 03testarray[idx] = 04testarray[idx] = 05testarray[idx] = 06testarray[idx] = 07testarray[idx] = 08testarray[idx] = 09:testarray[idx] = 60testarray[idx] = 61testarray[idx] = 62testarray[idx] = 63
The following Discussion Forum threads mayprovide information related to this topic.
联系客服