打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
μVISION DEBUGGER: HOW CAN I LOG VARIABLE VALUES TO A FILE

μ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 μ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.

ANSWER

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:

  • Use the μVision save command to save the data in a hex 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.

  • You can display the values in the command window and log them to a file:
    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 off
    You will see the same text output in the file that wasspecified with the μVision LOG command (MyValues.log in thisexample).
  • 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.

    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 invocation
    or 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

SEE ALSO

FORUM THREADS

The following Discussion Forum threads mayprovide information related to this topic.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
babelua
javascript谷歌浏览器调试的时候认为封闭的局部变量是undefined
Intellij IDEA的优化总结
How to Setup BDGp debugger in Notepad to De...
How to debug python script
Writing a Linux Debugger Part 9: Handling variables
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服