INFINEON DAVE4使用教程分析和总结.docxVIP

  • 27
  • 0
  • 约2千字
  • 约 3页
  • 2023-05-12 发布于湖北
  • 举报
DAVE4A 使用教程 精心整理 一:打开软件 右上角选择 DAVECE。以后软件的使用大部分都在 DAVECE 下。 二:新建工程 File-new-DAVEProject 选择 DAVECEProject,并填写 ProjectName。点 next。选择芯片型号,点 finish。 可以看到新的工程 aa 已经生成。 3:怎样编写程序 Infineon 的 DAVE 开发软件对于各种 cpu 的外设驱动,都是通过 app 生成的,不得不说,这是非常方便的,节省了大量看文档,编写驱动的时间。 下面编写一个 pwm 的程序,完成如下功能,输出 20kHZ 的方波,并产生 20khz 的中断。单击 AddNewAPP(绿色加号) 搜索里输入 pwm 选择,中括号里的是版本号,不用在意。单击 add。APPDependency 就已经有了 pwm 了。 不知道怎么使用,可以右键点击 PWM,选择 APPHelp。APPConfigurationParameters,这里会详细描述各个参数怎么设定。Usage,这里会给出使用的例子,这是我很喜欢看的地方,很有用。Frequency 改为 20K 选择比较中断,中断需要和其他的 APP 相连接,所以给出提示,我们之后再连接,直接点 ok 就可以了。 点击 AddNewAPP 精心整理 精心整理 选择 INTERRUPT, 双击 INTERRUPTAPP,可以配置参数,包括中断优先级,设置中断函数名(修改 interrupthandler)。右键点击 PWM,点击 HW_Signal_Connection。 配置如上,将 pwm 的比较中断和 interrupt 连接起来。单击 save 保存。HWsignalconnectivity 里可以看到连接情况。 点击 ManualPinAllocator,可以配置 pwm 的输出脚。配置为 p0.12,点击 save。 点击 GenerateCode,可以生成代码生成的代码在 Dave-Gerated 里面。修改 main.c,编写程序就可以了。 /* *main.c * *Createdon:2017Mar2713:42:56 *Author:yanfa */ #includeDAVE.h//DeclarationsfromDAVECodeGeneration(includesSFRdeclaration) /** *@briefmain()-Applicationentrypoint * *bDetailsoffunction/bbr *Thisroutineistheapplicationentrypoint.Itisinvokedbythedevicestartupcode.Itisresponsi blefor *invokingtheAPPinitializationdispatcherroutine-DAVE_Init()andhostingtheplace-holderfo ruserapplication *code. */ voidUserIRQHandler() { } intmain(void) { DAVE_STATUS_tstatus; status=DAVE_Init();/*InitializationofDAVEAPPs*/ if(status!=DAVE_STATUS_SUCCESS ) { /*Placeholderforerrorhandlercode.Thewhileloopbelowcanbereplacedwithanusererrorhandler .*/ XMC_DEBUG(DAVEAPPsinitializationfailed\n); while(1U) { } } PWM_Start(PWM_0); /*Placeholderforuserapplicationcode.Thewhileloopbelowcanbereplacedwithuserapplication code.*/ while(1U) { } }。 UserIRQHandler 就是 pwm 的中断函数,每秒触发 20k 次。点击 BuidActiveProject 编译就可以了。 4:调试程序 点击 DebugConfiguration 双击 GDBSEGGERJ-LINKDebugging 点击 Debugger,inerface 选择 JTAG。点击 Apply,就配置好了。之后点击 Debug 就可以通过 JLINK 仿真器编程下载了。 5:导入工程 可以导入 DAVE4 的工程点击 import 选择 DAVEProject 选择目录 点击 finish 就导入成功了。

文档评论(0)

1亿VIP精品文档

相关文档