当前位置:首页 >> 信息与通信 >>

Codewarrior处理器专家快速入门_图文

Codewarrior Processor Expert 处理器专家快速入门
Terry Tian R63492@freescale.com
Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.
TM

快速入门
1. 创建新工程
在创建向导中,对话框中 would you like to use Processor Expert? 选 择Yes选项 2. 配置外设(Beans) ? 配置CPU,封装,存储器映射,时钟 ? 添加新模块,设置属性参数,函数,中断 ? 重复以上步骤,对其他需要的模块进行设置 3. 产生代码 ? 直接点击make图标,产生代码,并进行编译 4. 使用产生的代码 ? 在主文件中加入自己的代码 ? 在Events.c中加入中断处理程序 ? 在processor expert页里面,打开Bean,列出函数,中断。可以通过 直接拖拉的方式拽到自己的代码中 ?

Slide 1
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

选择Yes

Slide 2
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

CPU窗口

模块属性,函数中断 设置窗口 Processor Expert 页窗口 模块选择窗口

Slide 3
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

选封装

Slide 4
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

双击

设置CPU

Slide 5
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

设置CPU PLL 内存分配 晶振频率
Slide 6
TM

总线时钟

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

Slide 7
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

点击右键

添加新模块

Slide 8
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

在Bean选择窗口中,打开On-Chip Peripheral页,在列出的外设中,选 择外设模块

Slide 9
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

选择Timer ECT外设,其功能为输入捕捉

选中以后,点击Add 或 Add&Close
Slide 10
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

双击左键 设置捕捉属性 名称,引脚,上拉/下拉, 沿触发方式,中断使能, 事件最大时间

Slide 11
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

完成属性设置

Slide 12
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

选择要生成的函数 鼠标放在函数名称处,可以 显示函数说明,名称,返回 值

Slide 13
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

中断函数设置,名称

Slide 14
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

点击 make图标,产生代码

Slide 15
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

观察自动生成的代码,加 入自己的代码

自动生成的代码文件 Main函数在“工程名.C” 文件 所有的中断函数都在这个Events.c文件中
Slide 16
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

在Events.c文件中加入新的 中断函数

捕捉中断函数, 无需对标志位 清零

Slide 17
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

打开processor expert, 把GetCaptureValue 函数拖入到中断函数中

Slide 18
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

把读取捕捉值的 函数拖过来以后, 鼠标放到函数旁 边,观察说明, 调用方法

Slide 19
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

写中断函数 得到脉冲时间间隔,编 译下载程序

Slide 20
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

点击右键

添加新模块

Slide 21
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

选择Timer PWM0外设,其功能为PWM

选中以后,点击Add 或 Add&Close
Slide 22
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

设置属性 引脚 双击左键 中断使能 周期 占空比
Slide 23
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

设置函数

Slide 24
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

设置中断 因为禁止中断 所以无法产生中断代码

Slide 25
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

也可通过点击右键,使能或禁 止某函数 绿色为禁止

Slide 26
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

点击编译,生成代码

Slide 27
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

拖过拖拉,或自己键入,调用生成的函数, 调节占空比

Slide 28
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

双击左键,可以查看生成的函数代码 或在函数名称处点击右键,可以查看生成 的函数代码

Slide 29
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

函数在PWM6.C文件中

Slide 30
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.

帮助文档

动画向导

Slide 31
TM

Freescale Semiconductor Confidential and Proprietary Information. Freescale ? and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ? Freescale Semiconductor, Inc. 2005.