[Atmel] 用ASF跑SAMD21程序(26)BOD33

[复制链接]
1297|0
 楼主| ddllxxrr 发表于 2015-1-31 14:46 | 显示全部楼层 |阅读模式
本帖最后由 ddllxxrr 于 2015-1-31 15:42 编辑

BOD33是用来监视,3.3伏电压,若低于电压就重新启动。

首选建立ASF工程,添加BOD33模块,



然后打开,ASF EXPLORER点开快速指导。然后根据提示形成程序




以下是程序编译通过的截图:




由于开发板供电充足所以没有办法实测,只是等着以后开发时看看通否用到该功能吧。


程序清单:
  1. /**
  2. * \file
  3. *
  4. * \brief Empty user application template
  5. *
  6. */

  7. /**
  8. * \mainpage User Application template doxygen documentation
  9. *
  10. * \par Empty user application template
  11. *
  12. * This is a bare minimum user application template.
  13. *
  14. * For documentation of the board, go \ref group_common_boards "here" for a link
  15. * to the board-specific documentation.
  16. *
  17. * \par Content
  18. *
  19. * -# Include the ASF header files (through asf.h)
  20. * -# Minimal main function that starts with a call to system_init()
  21. * -# Basic usage of on-board LED and button
  22. * -# "Insert application code here" comment
  23. *
  24. */

  25. /*
  26. * Include header files for all drivers that have been imported from
  27. * Atmel Software Framework (ASF).
  28. */

  29. void configure_bod33(void);
  30. #include <asf.h>

  31. void configure_bod33(void)
  32. {
  33.         struct bod_config config_bod33;
  34.         bod_get_config_defaults(&config_bod33);
  35.         bod_set_config(BOD_BOD33, &config_bod33);
  36.         bod_enable(BOD_BOD33);
  37. }

  38. int main (void)
  39. {
  40.         system_init();
  41.     configure_bod33();
  42.         // Insert application code here, after the board has been initialized.

  43.         // This skeleton code simply sets the LED to the state of the button.
  44.         while (1) {
  45.                
  46.         }
  47. }


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:http://shop34182318.taobao.com/ http://shop562064536.taobao.com

2404

主题

7001

帖子

68

粉丝
快速回复 在线客服 返回列表 返回顶部