AtmelStudio-6.0简易入门教程(精炼实用)

合集下载

Atmel Studio 6 微控制器开发环境介绍说明书

Atmel Studio 6 微控制器开发环境介绍说明书

Atmel® Studio 6 is the integrated development environment (IDE) for developing and debugging embedded applications based on Atmel AVR® and ARM® Cortex™-M microcontrollers (MCUs) in C/C++ and assembly code. The IDE makes editing and debugging source code easier by seamlessly bringing together an intelligent editor with assisted code writing, a wizard for quickly creating new projects, the Atmel Software Framework with free source code library, a GNU C/C++ Compiler, a powerful simulator, and the front-end for all Atmel programmers and in-circuit debuggers.Atmel Studio 6 is free of charge and available for download at /atmelstudio.What’s New in Atmel Studio 6• Support for Atmel ARM Cortex-M based MCUs• Fully integrated Atmel QTouch® Composer• Full support for C++Your Avenue to Atmel AVR and ARM Cortex-M Based MCU DesignDesigners using AVR MCUs are already familiar with our IDE, previously known as AVR Studio® 5. Now, the communityof ARM Cortex-M design engineers can take advantage of the same easy-to-use, professional and highly integrated development platform.Integrated QTouch ComposerFully integrated into Atmel Studio 6, Atmel QTouch Composermakes it easy to build touch functionality into your design.QTouch Composer is the front-end software used to displayand evaluate the data reported from your touch design,making it easy for you to inspect how well your touchimplementation performs. With this integration, you can easilyand seamlessly develop capacitive touch functionality into yourapplication. You won’t need to toggle between different toolsto edit the code in Atmel Studio 6 and fine-tune your touchdesign in QTouch Composer.Atmel Software FrameworkThe Atmel Software Framework contains drivers for all peripherals,communication stacks, graphics, digital signal processing (DSP) and audiolibraries, and nearly 1,000 complete example designs. Using free source codefrom the Atmel Software Framework will accelerate the development of newapplications, while lowering your overall costs.Debugging Made EasyAtmel Studio 6 connects directly to Atmel debuggers and programmers. One of thebiggest advantages of modern MCUs is their ability to send debug data to your PC, givingyou a perfect view of what goes on inside. With a debugger connected, Atmel Studio 6can present the status of all processors, memories, communication interfaces and analoginterfaces in nicely formatted views, giving you access to critical system parameters. Theresimply is no faster way to identify bugs and optimize a design—in the lab or in the field.To learn more or download Atmel Studio 6 free of charge, visit /atmelstudio .© 2012 Atmel Corporation. All rights reserved. / Rev.: 8487B-Studio6-E-A4-09/12Atmel ®, Atmel logo and combinations thereof, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. ARM ®, ARMPowered ® logo and others are the registered trademarks or trademarks of ARM Ltd. Other terms and product names may be the trademarks of others. Atmel logo and combinations thereof, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries.Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441-0311 F: (+1)(408) 487-2600 | 。

visual basic6.0精简版使用方法

visual basic6.0精简版使用方法

visualbasic6.0精简版使用方法Visual Basic 6.0是一种老版本的编程语言和集成开发环境(IDE),用于快速开发Windows应用程序。

以下是Visual Basic 6.0精简版的简要使用方法:1. **安装和设置**- 下载和安装Visual Basic 6.0精简版的安装程序。

- 运行安装程序,按照提示进行安装,并选择合适的安装选项。

- 安装完成后,打开Visual Basic 6.0精简版。

2. **创建新项目**- 打开Visual Basic 6.0精简版后,选择"File" 菜单,然后选择"New Project"。

- 在弹出的对话框中,选择项目模板,例如"Standard EXE"(标准可执行文件)。

- 点击"OK" 创建新项目。

3. **界面设计**- 在项目中,使用可视化设计器创建和设计用户界面。

- 在"Toolbox" 工具箱中选择所需的控件(如按钮、文本框、标签等),然后在窗体上拖放控件,调整其位置和大小。

- 双击控件可打开对应控件的代码编辑器,编写控件的事件处理程序。

4. **编写代码**- 在"Code" 窗口中编写程序逻辑。

- 使用Visual Basic 6.0的语法和函数,编写事件处理程序、条件判断和循环等代码。

- 可以使用内置的开发工具和功能,如代码提示、调试工具等,加快开发过程。

5. **编译和运行**- 完成代码编写后,选择"File" 菜单,然后选择"Make xxx.exe",其中"xxx" 是你的项目名称。

- 编译完成后,会生成一个可执行文件(.exe),该文件可以在Windows上运行你的应用程序。

需要注意的是,由于Visual Basic 6.0是一种老版本的开发工具,如果你的操作系统是Windows 7、8或10,可能会遇到兼容性问题。

AtmelStudio6.0 下程序的烧录操作

AtmelStudio6.0 下程序的烧录操作

AtmelStudio6.0 下程序的烧录操作
点击tools->Device Programming
出现如下画面:
选择Tool->JTAGICE mkll070000004699,这个选项是选择仿真器类型的,根据自己的仿真器类型选择就行了。

选择Device下的下拉菜单,选择自己的单片机型号。

选择Interface下的下拉菜单,选择ISP,然后点击Apply。

依次点击Target Voltage和Device signature下的Read,此时会读出当前片子的电压和地址。

点击左边栏目中的Memories,在右侧的复选框中找到工程路径下的.hex文件,点击Program,即可将程序下载到单片机内。

下载完成后会出现如下界面:
点击Fuses,此处是对单片机熔丝位的设置,所以选择要谨慎,否则单片机会被锁。

根据自己的晶振选择系统时钟,INTRCOSC为内部时钟信号,EXTXOSC 为外部时钟信号;内部时钟信号是以单片机内部的时钟为参考,外部时钟信号是以外接晶振为参考;由于atmega88单片机内部的晶振是LC震荡,所以并不精确,因此要用到定时器或者时序等,建议用外部晶振。

选择内部晶振:
选择外部晶振:
选择完成之后点击Program ,之后会出现如下显示,表示下载完成;如果熔丝位没有更改此处就不需要点击Program,如果更改了则需要重新Program之后才能生效。

AtmelStudio-6.0简易入门教程(精炼实用).

AtmelStudio-6.0简易入门教程(精炼实用).

一、建议工程文件AtmelStudi6.0这个全新的环境使用起来极其不顺手,因为首先我对AtmelStudio以前的版本也根本没有使用经验,就根据很陌生,其次,这个新版本软件还根本没有人用,根本没有任何的相关教程资料,唯一可以参考的只是官网的比较简单的视频教程,还是英文讲解,反正没怎么搞透。

不过还是硬着头皮用下去,因为软件是免费的,而且当后来我知道代码编辑环境其实就是微软VS环境的时候,我就更不犹豫了,大家应该都了解VS的代码编写环境是很智能的,尤其自动补全功能。

现在,我已经能很熟练的使用AtmelStudio6.0软件了,随着使用我也更加喜欢玩AVR单片机做一些小作品了,而不再用普通51和STC了。

当使用熟练以后也就感觉到其实这个免费智能的编译环境其实是很简单的,那现在我就帮助更多喜欢使用AVR而没用使用AtmelStudio软件的同学们轻松越过这一个门槛,进入一个美好的编程世界。

该软件的不足之处:一是软件相对较大,打开比较慢,但是运行还是比较顺利的;二是不支持山寨仿真器,这可苦了没钱的劳苦电工们了。

(不过我都是用ISP烧录调试,一般不用仿真)最下面附件有一个简单的LED_test工程文件,编译通过的。

大家可以试用。

下面开始介绍的软件工程的建立。

1. 软件总界面总体界面还是比较简洁的,和其他编译软件都是差不多的,而且和KEIL软件的界面是很相似的,使用很方便。

2. 新建工程新建工程很简单:FILE->NEW->Project 然后就看到下面的新建工程界面了,选择第一个GCC C Executable工程就可以,第二个GCC C static Library 是用来新建 .h文件的。

然后下面蓝圈1是C文件的名称,蓝圈2 Solution Name 是工程的文件,中间的Location是文件存放位置,自己选择合适的位置即可。

点击下面的OK3. 下面接着是单片机型号选择界面,选择合适的单片机就可以了。

Anime Studio Pro6 中文快速指南

Anime Studio Pro6 中文快速指南

Anime Studio Pro 72快速指南教程1.1:快速体验绘制一个简单图形Anime Studio界面这个教程是从头至尾快速地了解Anime Studio的主要功能,而不深入它的细节。

目的是浏览Anime Studio是怎样工作的,而不是教你怎样使用某一特定功能。

在这一教程中,我们将绘制和动画一个简单的物体。

Anime Studio有若干编辑模式组成了其不同的工作任务。

有些工具用于生成新物体,其他用于修饰和动画现有的物体。

Anime Studio基础工具组有:绘图、填充、骨骼 、层、摄像机和工作空间。

这节教程介绍了一部分绘图、填充和层工具,而后面的教程将对这些工具组的各个工具分别进行详细地介绍。

双击Anime Studio图标启动Anime Studio,或者在开始菜单(Windows)选择Anime Studio程序。

当你新建了一个Anime Studio文件,它会出现如下画面:选择“文件>新建”创建一个新的工程,然后点击当前工具图标(正好在“文件”菜单的下面),选择“重置全部工具”,这样可以使所有的工具恢复到默认值状态,以便你能够与这个教程同步。

点击工具栏里的“创建图形”工具选择它。

快速指南快速体验Anime Studio Pro 73插图那样,当“自动填充”选项被勾选,这个圆形将会自动填充颜创建图形工具椭圆形工具改变填充颜色从创建图形工具选项栏里选择椭圆形工具。

Anime Studio界面的右边的样式面板运出你为你绘制的图形选择填充和轮廓颜色。

要选择填充颜色,点击填充颜色框打开一个颜色选择面板,从中选择你想填充的颜色,然后点击“确定”按钮。

在主窗口点击并拖动鼠标,绘制一个圆形。

绘制时按住<shift>键则生成正圆形,而不是椭圆形。

注意保持该圆形在蓝色的方框内部(这个蓝色的矩形框表示你的作品的可视区域)。

注意,如前面的如果你不满意画出的圆形,从菜单栏中选“编辑>撤销”命令即可取消操作。

Visual-Basic-6.0安装步骤

Visual-Basic-6.0安装步骤
(图四)
注意:
1.在安装完sp5更新包后,某些系统会提示重新启动windows,选择重启后,即可完成全部安装
2.安装完毕后打开VB6.0,点击工具栏中的“帮助(H)”,在下拉菜单中选择“关于Microsoft Visual Basic(A)”,如下图所示
3.在弹出窗口中发现红框所标注字样,以及在序列号红线处中未出现“*”字样,即为完整安装完毕。
Visual Basic 6.0SP5更新包安装步骤
第一步:打开VB6 sp5文件夹,找到setupsp5.exe,双击执行
(图一)
第二步:在弹出窗口中选择“继续”
(图二)
第三步:在弹出窗口中选择“接受”,然后程序会自行安装
(图三)
第四步:安装完毕后,在弹出窗口中点击“确定”即可完成整个VB6.0的安装。
第十步:重启后出现“安装MSDN”窗口,把勾去掉,然后点击“下一步”,如图十红框标注位置
(图十)
第十一步:在“现在注册“窗口中不打勾,点击“完成”。如图十一红框标注位置
(图十一)
注意:
1.第六、第七步一定按步骤做,不然会导致某些VB功能不可用(此2步十分重要)
2.第五步可能在某些操作系统中不出现,可跳过,亦可选择“是”,推荐选择“否”
Visual Basic 6.0安装步骤
第一步:先解压vb6.0安装文件后打开VB60CHS文件夹找到setup.exe,双击打开,如图一所示。
(图一)
第二步:在弹出窗口中选择“接受协议”后,进行“下一步”。
(图二)
第三步:在输入ID窗口中都输入1,然后下一步。
(图三)
第四步:选择“安装visual basic6中文企业版”,然后下一步。在弹出窗口中点击“继续”。

VisualBasic6.0简明教程

VisualBasic6.0简明教程

VisualBasic6.0简明教程Visual Basic 6.0简明教程一、Visual Basic 6.0 概况Visual Basic 6.0简称VB6,是Visual Studio 6.0开发产品系列中的一员,该产品系列的成员有VC6、VFoxpro6、VinterDev、VJ++6等,基本上涵盖了Windows软件开发的方方面面。

其中VB更是其中用户喜爱的开发工具,它既是一种编程语言,同时也是一个强大的集成开发环境。

作为语言,它的语法简单、容易入门,作为开发环境,功能强大,操作便捷、自然;其面向对象的开发模型和思路能够充分解放程序员的想象力。

在VB5的基础上,Visual Basic 6.0又增加(增强)了许多特性,如:函数可以返回数组、本地代码编译(运行速度更快)、ActiveX编程;编写DHTML应用程序、服务器端的IIS 程序;升级了ComCtl32.ocx 和ComCt232.ocx等通用控件;集成的和MS-SQL连接和调试的能力;……相对于VB5,VB6增加(增强)了很多向导,例如:制作应用程序安装向导、数据对象向导、数据窗体向导、外接程序设计器、类生成器实用程序等等。

充分利用这些特性,会让你得心应手,事半功倍。

本文旨在让没有接触过VB的朋友能快速入门、以最新版本VB6帮助他们在尽可能短的时间内学会使用VB编程;同时让已经入门的朋友能在新版本中得到进一步提高。

二、Visual Basic 6.0 IDE(集成开发环境)VB6的开发环境和VB5基本类似。

程序一运行,就进入IDE环境。

我们经常要与IDE打交道,无论是设计窗体、控件、还是编写代码、调试程序,都要通过它来达到。

请一定要熟练的掌握IDE的操作要领。

下面对VB6的IDE界面给予简单的介绍,具体的操作请您自行反复尝试、练习,而这也是熟悉VB,掌握VB的不二法门。

(1)[新建工程]: 在[文件]主菜单下的命令,用于建立一个新的VB工程。

Atmel_Studio_6.1_简易使用教程

Atmel_Studio_6.1_简易使用教程

Atmel Studio 6.1简易使用教程 1 新建工程2 工程命名,以LED闪烁为例3 选择目标芯片,本例选择AT32UC3A02564 工程创建完成,在生成的main函数里编写相应代码5 Atmel Software Framework(简称ASF)为不同的MCU提供软件驱动和库来加快开发过程,ASF的架构如下图Your application对应要实现的软件应用Utilities对应开发工具和宏Boards对应开发板或者用户自定义板ASF由Drivers、Components和Services三部分组成:①Drivers对应片上设备的驱动,如ADC、FLASH、GPIO、INTC、PM、PWM、USART等②Components对应外设驱动,如存储器、显示屏、传感器等③Services对应FAT文件系统、DSP库、USB等6 导入ASF。

进行开发时,借用官方提供的驱动,可以大大简化开发进程在此添加Drivers/GPIO点击Apply将选择的模块添加到工程中7 此时编译发现报错双击错误进入错误位置查看Output,发现问题出在编译startup_uc3.S 文件时出现重复定义错误问题的原因在于:startup_uc3.S 文件是Atmel 官方自定义的启动文件,并非标准启动文件(crt0.o,指定main 函数的入口地址),在工程属性里应该设置不使用标准启动文件,否则就会出现重复定义的错误。

解决:在工程目录中右键选择工程属性再次编译,成功通过_start 和_stext 在startup_uc3.S 文件中重复定义,第一次定义在crt0.o 文件中8 在main函数中编写相应代码,实现LED闪烁控制。

9 编译通过后,将生成的.hex或.elf烧写文件下载到flash中看运行结果。

AtmelStudio-6.0简易入门教程(精炼实用)

AtmelStudio-6.0简易入门教程(精炼实用)

一、建议工程文件AtmelStudi6.0这个全新的环境使用起来极其不顺手,因为首先我对AtmelStudio以前的版本也根本没有使用经验,就根据很陌生,其次,这个新版本软件还根本没有人用,根本没有任何的相关教程资料,唯一可以参考的只是官网的比较简单的视频教程,还是英文讲解,反正没怎么搞透。

不过还是硬着头皮用下去,因为软件是免费的,而且当后来我知道代码编辑环境其实就是微软VS环境的时候,我就更不犹豫了,大家应该都了解VS的代码编写环境是很智能的,尤其自动补全功能。

现在,我已经能很熟练的使用AtmelStudio6.0软件了,随着使用我也更加喜欢玩AVR单片机做一些小作品了,而不再用普通51和STC了。

当使用熟练以后也就感觉到其实这个免费智能的编译环境其实是很简单的,那现在我就帮助更多喜欢使用AVR而没用使用AtmelStudio软件的同学们轻松越过这一个门槛,进入一个美好的编程世界。

该软件的不足之处:一是软件相对较大,打开比较慢,但是运行还是比较顺利的;二是不支持山寨仿真器,这可苦了没钱的劳苦电工们了。

(不过我都是用ISP烧录调试,一般不用仿真)最下面附件有一个简单的LED_test工程文件,编译通过的。

大家可以试用。

下面开始介绍的软件工程的建立。

1. 软件总界面总体界面还是比较简洁的,和其他编译软件都是差不多的,而且和KEIL软件的界面是很相似的,使用很方便。

2. 新建工程新建工程很简单:FILE->NEW->Project 然后就看到下面的新建工程界面了,选择第一个GCC C Executable工程就可以,第二个GCC C static Library 是用来新建 .h文件的。

然后下面蓝圈1是C文件的名称,蓝圈2 Solution Name 是工程的文件,中间的Location是文件存放位置,自己选择合适的位置即可。

点击下面的OK3. 下面接着是单片机型号选择界面,选择合适的单片机就可以了。

AVR Studio简易入门教程

AVR Studio简易入门教程

建立一个工程文件AtmelStudi6.0这个全新的环境使用起来极其不顺手,因为首先我对AtmelStudio以前的版本也根本没有使用经验,就根据很陌生,其次,这个新版本软件还根本没有人用,根本没有任何的相关教程资料,唯一可以参考的只是官网的比较简单的视频教程,还是英文讲解,反正没怎么搞透。

不过还是硬着头皮用下去,因为软件是免费的,而且当后来我知道代码编辑环境其实就是微软VS环境的时候,我就更不犹豫了,大家应该都了解VS的代码编写环境是很智能的,尤其自动补全功能。

现在,我已经能很熟练的使用AtmelStudio6.0软件了,随着使用我也更加喜欢玩A VR 单片机做一些小作品了,而不再用普通51和STC了。

当使用熟练以后也就感觉到其实这个免费智能的编译环境其实是很简单的,那现在我就帮助更多喜欢使用A VR而没用使用AtmelStudio软件的同学们轻松越过这一个门槛,进入一个美好的编程世界。

该软件的不足之处:一是软件相对较大,打开比较慢,但是运行还是比较顺利的;二是不支持山寨仿真器,这可苦了没钱的劳苦电工们了。

(不过我都是用ISP烧录调试,一般不用仿真)最下面附件有一个简单的LED_test工程文件,编译通过的。

大家可以试用。

下面开始介绍的软件工程的建立。

1. 软件总界面总体界面还是比较简洁的,和其他编译软件都是差不多的,而且和KEIL软件的界面是很相似的,使用很方便。

2. 新建工程新建工程很简单:FILE->NEW->Project 然后就看到下面的新建工程界面了,选择第一个GCC C Executable工程就可以,第二个GCC C static Library 是用来新建 .h文件的。

然后下面蓝圈1是C文件的名称,蓝圈2 Solution Name 是工程的文件,中间的Location是文件存放位置,自己选择合适的位置即可。

点击下面的OK3. 下面接着是单片机型号选择界面,选择合适的单片机就可以了。

Atmel Studio 6.2开发环境的搭建和使用

Atmel Studio 6.2开发环境的搭建和使用
将开发其他扩展部分按图2-7所示连接。
点击绿色的小三角图标(Starting Debugging)开始调试。
可能会弹出如(图2-8)的提示升级,点击升级即可。
再次点击StartingDebugging调试,待编译成功之后,可能会弹出如图2-
9所示的对话框
选择EDBG即可,然后点击StartingDebugging即可烧录程序进入调试模
下载成功之后安装即可。
安装完成以后,点击图标打开Atmel Studio 6.2(如图2-2所示)
图标还是挺可爱的(~。~)。。
打开atmelStudio(如图3所示)将开发板用USB连接到电脑的USB端
口,电脑会自动安装板子的驱动的。
个人认为学习任何一款软件,建议先去使用Help菜单,查看里面的帮助
式。
完成程序下载后,点击运行。
点击BUTTON1可以切换不同的功能,3个LED对应着不同的功能,分
别是温度计、光照强度、检查SD空间。
如果打开Atmel-42075-SAM4S-Xplained-Pro_User-Guide.pdf开发文档,
里面会有这幺一段话:
简单3步就可以实现对Atmel SAM4S Xplained Pro的开发:
1.下载并安装Atmel Studio
2.打开Atmel Studio
3.用USB线连接到AtmelSAM4S-Xplained-Pro的EDBUG(Embedded
Atmel Studio 6.2开发环境的搭建和使用
本篇搭建和使用的是AtmelStudio6.2开发环境。AtmelStudio6.2中也给
出了这个发板的示例程序,本篇文章就一步一步的通过下载和搭建开发环
境,下载程序到开发板中。我就先来试用ATMEL公司的官方开发环境atmel

学习使用AtmelStudio进行嵌入式系统开发

学习使用AtmelStudio进行嵌入式系统开发

学习使用AtmelStudio进行嵌入式系统开发嵌入式系统是指将微处理器或微控制器嵌入到其他设备中,实现特定功能的系统。

AtmelStudio是一款由微处理器制造商Atmel 公司开发的集成开发环境,专门用于嵌入式系统开发。

本文将介绍如何使用AtmelStudio进行嵌入式系统开发,并按照不同的类别划分为几个章节。

第一章:AtmelStudio简介AtmelStudio是Atmel公司为自家产品Atmel AVR和ARM微控制器提供的集成开发环境。

它基于Visual Studio平台,提供了丰富的开发工具和调试功能。

使用这一工具可以大大加快嵌入式系统开发的速度并提高开发效率。

第二章:环境搭建在使用AtmelStudio进行嵌入式系统开发之前,我们首先需要搭建相应的开发环境。

具体步骤如下:1. 下载并安装最新版的AtmelStudio。

可以从Atmel公司官网上找到最新的版本并进行下载。

安装过程很简单,按照指导完成即可。

2. 配置编译器。

AtmelStudio支持多种编译器,包括GCC和IAR等。

根据项目需求选择所需的编译器,并进行相应的配置。

3. 配置调试工具。

AtmelStudio支持多种调试工具,如ICE和JTAG等。

选择合适的调试工具,并配置好与开发板的连接。

第三章:新建项目在AtmelStudio中创建新项目是进行嵌入式系统开发的第一步。

具体操作如下:1. 打开AtmelStudio,在开始界面点击"新建项目"按钮。

2. 在弹出的对话框中选择项目模板。

AtmelStudio提供了多种常见的项目模板,如Blink示例、USART通信和PWM控制等。

根据项目需求选择合适的模板。

3. 设置项目文件名和存储路径。

根据个人喜好设置合适的文件名和存储路径。

4. 配置项目属性。

根据具体需求配置项目属性,如选择使用的编译器和调试工具等。

第四章:编写代码在AtmelStudio中编写嵌入式系统代码是进行项目开发的核心步骤。

Atmel Studio6用户指南

Atmel Studio6用户指南

Atmel AVR4029: Atmel Software FrameworkUser GuideFeatures• Getting Started• Access to ASF examples and applications• Add ASF modules to a project• Atmel® Studio 6• IAR™• GNU makefile / GCC1 IntroductionThe Atmel software framework (ASF, /asf) provides software drivers and libraries to build applications for Atmel megaAVR®, AVR XMEGA®, AVR UC3and SAM devices. It has been designed to help develop and glue together the different components of a software design. It can easily integrate into an operating system (OS) or run as a stand-alone product.In this application note developers can read about how to get started with Atmel Studio 6, IAR and GNU GCC makefile:•How to install the ASF•How to start ASF reference applications•How to get ASF documentationIt is recommended but not required to read the ASF reference manual for advanced knowledge on the ASF architecture to read this getting started document. Atmel Microcontrollers Application NoteRev. 8431C-AVR-03/20132 ASF OverviewThe following is a basic overview of the ASF. For more details, consider reading theASF Reference manual.2.1 ASF LayersThe ASF is basically organized in layers for each Atmel family of devices (see figurein Introduction).2.2 ASF ItemsThere are mainly three kinds of items in the ASF:•ASF Module: a software entity that does not have an int main(void) function(e.g. a USART software driver, a USB stack). ASF modules are provided bythe Drivers, Components and Services layers. An ASF module may bestatically and/or dynamically configurable.•ASF Application (aka ASF Example): a software entity in the ASF that can bebuilt into an executable. This can be: a demo application, or an example ofusage of an ASF module. ASF applications are provided by the Drivers,Components, Services and Applications layers. An ASF application used asan example of usage of one ASF module is called an ASF Example. An ASFapplication may be statically configurable.•ASF Board: abstraction layer for each Atmel kit supported in the ASF. Usuallyassociated with one device. The “special” board named “User board” is anempty board abstraction layer used to create a user-specific/custom board.2.3 ASF PortsThere are four ports of the ASF, one for each Atmel family of devices: megaAVR,AVR XMEGA, AVR UC3 and SAM.The common top folder gathers modules and applications shared amongst severalarchitectures: in some cases the implementations are shared while for some modulesonly the API is common. For the latter, the common folder thus also contains ports foreach Atmel family of devices.The thirdparty top folder contains modules and applications with licenses other thanthe Atmel ASF license. As for the common folder, thirdparty is not dedicated to onefamily but contains instead ports to for each Atmel family of devices.2.4 ASF Directory StructureThere is a top level folder for each Atmel family of devices as well as the commonand thirdparty folders.The organization beneath each of these folders is following the ASF layers split(applications, services, components, drivers, boards).Note that the folder of an ASF module always contains at least an example of usagewhich is an ASF item of type ASF application.2.5 ASF Releases FormatsEach ASF release is fully documented and available online at .2 Atmel AVR40298431C-AVR-03/2013AtmelAVR4029Each ASF version is released in two ways:•As an extension to Atmel Studio 6,•Stand-alone zip package of the whole ASF directory tree with, for each ASFapplication, a make project and an IAR project.Note that Atmel Studio 6 has dedicated menus and actions for the ASF (which arepresented later in the document).3 8431C-AVR-03/20134 Atmel AVR40298431C-AVR-03/2013 3 Getting started with ASF and Atmel Studio 6Atmel Studio 6 is the integrated development environment (IDE) for developing and debugging Atmel ARM ® Cortex™-M and Atmel AVR ® microcontroller (MCU) based applications.Content and features of Atmel Studio 6:• Solutions and projects creation,• a powerful editor with visual assist and plug-ins support to enhance the IDE, • a GNU C/C++ Compiler for generating target executables,• the ASF and ASF-oriented wizards,• Programming & Debugging mode supporting all Atmel debuggers,programmers and the AVR simulator. In debugging mode, the IDE presents MCU status in nicely formatted views, giving fast access to critical system parameters.• Atmel Gallery3.1 Installation - Requirements3.1.1 Software Tools1. Download Atmel Studio 6 on /atmelstudio . The Atmel ASF is included in Studio 6 and does not require a separate download.2. Install.3. Launch Atmel Studio: refer to embedded Atmel Studio user guide and getting started in the welcome screen to get started with Atmel Studio.Further ASF updates: get ASF updates from the Extension Manager.3.1.2 Hardware ToolsOn top of the AVR simulator provided with Atmel Studio 6, Atmel Studio 6 connects to all hardware kits, programmers and debuggers supporting all existing Atmel devices.3.2 Start ASF examples1. In the file menu, select New -> Example Project from ASF.Figure 3-1. New example project from ASF.AtmelAVR4029It is possible to sort the ASF examples by kits (for example, Atmel EVK1100, AtmelAVR Xplained…), by technology keywords (for example, USB, IO, Interrupt…) or bycategory (drivers, components, services, applications). The example documentationcan be viewed by clicking the help icon in the right panel of the New Example Projectwindow. Find the project "USART Example – XMEGA-A1 Xplained" and click OK tocreate it.Figure 3-2. Selecting a new ASF example for a kit.5 8431C-AVR-03/2013Figure 3-3. ASF examples solution explorer view.2. It is now possible to compile, load and debug the project. The Atmel ASF files areimported into a new Atmel Studio project in the src folder. Example files arelocated in the src/ folder. Dependency files are located in the src/asf/ folder.Connect a debugger to the PC and run the ASF example.3. The ASF Explorer is a logical view of ASF code, with easy access to API anddocumentation.Figure 3-4.ASF Explorer view.6 Atmel AVR40298431C-AVR-03/2013AtmelAVR40297 8431C-AVR-03/2013 3.3 Get ASF examples documentation• Right click on the project name• Select “View ASF Project Examples help”Figure 3-5. ASF examples documentation.3.4 Add ASF modules to an existing projectIt is possible to add/remove ASF modules to any project.1. Right click on the project or project menu, and then click on “ASF Wizard”. Figure 3-6. Adding Atmel ASF modules to a project.8 Atmel AVR40298431C-AVR-03/2013 2. Select one or several ASF modules, and then click on “Add to selection” (displayed as “>>”). In this example, the RTC driver is selected.Figure 3-7. Adding an Atmel ASF module to a project.3. The RTC driver is then added to the “Selected Modules” list in green and in italic. This means it is not yet fully added and requires confirmation. Click on the “Apply” button for that.Figure 3-8.Adding an Atmel ASF module to a project (continued)AtmelAVR40299 8431C-AVR-03/2013 4. After clicking on “Apply”, a pop-up window appears summarizing theaddition/deletion operations that will be performed on the current project. Note that non-selected modules may appear due to dependencies (for example the RTC driver uses the Sleep manager which relies on the Sleep Controller driver (see screenshot here below)).Figure 3-9Adding an Atmel ASF module to a project (continued)5. Finally, click on “OK”. For example, the RTC – Real Time Counter driver rtc.c and rtc.h files are added in the src/asf/xmega/drivers/rtc folder.Figure 3-10 Solution explorer of an ASF example.3.5 Start a new project with a template: User Application TemplateUser application templates are ready to use projects with:• A main.c file and a main() function• A basic set of ASF drivers (GPIO, interrupt) located in src/asf/ folder for theselected Atmel MCU•An ASF board definition file. For example, for the Atmel XMEGA-A1 Xplained kit,the src/asf/xmega/boards/xmega_a1_xplained/xmega_a1_xplained.h file is added.To access User Application Template:1. Click on File->New -> Project.2. In C/C++-> Atmel Boards menu, select the User Application Template for thewanted Atmel board.Figure 3-11. New user template project for an Atmel board.3. Click OK.10 Atmel AVR40298431C-AVR-03/2013AtmelAVR402911 Figure 3-12. New user template project for the Atmel XMEGA-A1 Xplained.3.6 Using the Atmel GalleryThe Atmel Gallery contains extensions to the Atmel Studio platform in the form of development tools or embedded software.The Atmel Gallery is accessible through the Extension Manager. The Extension Manager is used to add, remove, enable, and disable Atmel Studio extensions. To open the Extension Manager, on the Tools menu, click Extension Manager. Figure 3-13.Extension Manager Installed ExtensionsFor more information see the Atmel Studio Help (ctrl-F1), section “Extending Atmel Studio”. For installing new extensions in Atmel Studio, select the step by step section “Installing new extensions in Atmel Studio”. Check also the “XDK – User Guide” document available on .3.7 VideoGetting started with a video of Atmel Studio and ASF, follow Atmel videos on/user/AtmelCorporation.12 Atmel AVR4029AtmelAVR40294 ASF-based Development Flow in Atmel StudioGiven the numerous available ASF Modules, Applications and Boards provided by theASF and the ASF-based wizards provided in Atmel Studio, there is more than oneway to develop an application based on the ASF. The purpose of this section is toguide the user on how to use the ASF in Atmel Studio along a typical developmentflow.We will first identify a list of development scenarios then we’ll see how each can bedone using the ASF in Atmel Studio.4.1 Development Types: OverviewThere are mostly, if not only, two main kind of development with the ASF:•on an Atmel board,•on a custom board (aka user board).4.1.1 Development on an Atmel BoardThere are mainly four scenarios:•Run (and eventually modify) an existing ASF Example on an AtmelReferenced Board•Develop a New ASF-based Application on an Atmel Referenced Board•Using the ASF, port a non-ASF existing application on an Atmel ReferencedBoard•Develop a non-ASF-based Application on an Atmel Referenced Board: out ofscope.4.1.2 Development on a Custom Board (aka User Board)We will consider only the most relevant scenario: develop a Custom Application on aCustom Board. There are mainly three approaches to do that:•Modify an existing ASF example that is the closest to the target application,port it to the custom board, then modify the application as needed•Develop a New ASF-based Application to a Custom Board•Using the ASF, port a non-ASF existing application to a Custom Board•Develop a non-ASF-based Application on a custom board: this is out of thissection’s scope4.1.3 Release on the Atmel GallerySince the introduction of the Atmel Gallery and the Atmel Studio ExtensionDeveloper’s Kit (XDK), it is now possible to release any development to the AtmelGallery. Refer to the XDK User Guide.135 Getting started with ASF and IAR Embedded Workbench5.1 Install1. Download IAR Embedded Workbench® on .2. Install IAR.3. Download the ASF standalone archive (.zip file) from /asf.4. Extract the ASF standalone archive on your hard drive (preferably on a locationclose to the root, to avoid any potential long name length issue on Windows®).5.2 Header files updateFor 8-bit AVR users it is recommended to update the toolchain header files, adescription about how to do that is located in the readme.txt file under thexmega/utils/header_files/ directory.For AVR UC3 users, it is recommended to update the IAR header files. To do that,unzip the avr32-headers.zip file (located under the avr32/utils/header_files/ directory)to the IAR EWAVR32 installation folder under "IAR installation folder"/EmbeddedWorkbench x.y/avr32/inc/.5.3 Navigating in the ASF standalone archiveThe top folder organization is as follow:•The avr32/ folder contains software modules (source code and projects) dedicatedto AVR UC3 devices•The mega/ folder contains software modules (source code and projects) dedicatedto Atmel megaAVR devices•The xmega/ folder contains software modules (source code and projects)dedicated to Atmel AVR XMEGA devices•The common/ folder contains software modules (source code and projects) sharedby all Atmel AVR devices•The sam/ fodler contains software modules (source code and projects) dedicatedto Atmel SAM devices•The thirdparty/ folder contains software modules (source code and projects) fromthirdparty providers for all AVR devicesThe thirdparty/ folder is organized by thirdparty software module (that is, one folderper thirdparty software module).The avr32/, xmega/, mega/, sam/ and common/ folders are organized as follow:•The drivers/ folder contains low-level software drivers for Atmel MCU on-chipresources (for example, cpu, usart, adc drivers)•The boards/ folder contains board-specific source code files•The utils/ folder contains files that are used by all other modules: it holds severallinker script files, IAR & GCC pre-compiled libraries of some ASF modules, andC/C++ utility files with general usage defines, macros and functions•The services/ folder contains application-oriented pieces of software that are notspecific to boards nor chips (for example, FAT, TCP/IP stack, OS, JPEG decoder).For the common/ top folder, the services/ folder also contains chip-specific code 14 Atmel AVR4029AtmelAVR4029•The components/ folder offers, for each supported hardware component, asoftware interface to interact with the component (for example, memories likeSDRAM, SD card, or display)•The applications/ folder contains hefty examples of applications using servicesand drivers5.4 Start ASF examplesUsing an example of usage of the Atmel AVR UC3 GPIO driver module, the IARprojects are located under:•avr32/drivers/gpio/peripheral_bus_example/at32uc3a0512_evk1000/iar/ for anAtmel EVK1100 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3a0512_evk1105/iar/ for anAtmel EVK1105 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3b0256_evk1101/iar/ for anAtmel EVK1101 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3a3256_evk1104/iar/ for anAtmel EVK1104 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3l064_stk600-rcuc3l0/iar/ for anAtmel STK®600-RCUC3L0 setup•avr32/drivers/gpio/peripheral_bus_example/at32uc3c0512c_uc3c_ek/iar/ for anAtmel AT32UC3C-EK board•avr32/drivers/gpio/peripheral_bus_example/at32uc3l064_uc3l_ek/iar/ for an AtmelAT32UC3L-EK boardEach iar/ folder contains a full IAR project with:•an IAR EWAVR32 workspace file(avr32_drivers_gpio_peripheral_bus_example_uc3l_ek.eww: double-click on thisfile to open the whole project)•an IAR EWAVR32 project file(avr32_drivers_gpio_peripheral_bus_example_uc3l_ek.ewp)•an IAR EWAVR32 debug configuration file(avr32_drivers_gpio_peripheral_bus_example_uc3l_ek.ewd)15Figure 5-1. IAR project location in the ASF.5.5 Get ASF project documentation5.5.1 Online DocumentationAll ASF module and reference application Doxygen documentation can be found on.5.5.2 Manual Documentation Generation (offline)All modules are fully documented using doxygen tags. Each project within the AtmelASF contains a doxyfile.doxygen (used to configure doxygen for a properdocumentation generation): to generate the .html documentation, doxygen must beinstalled (see /download.html) and the doxyfile.doxygen mustbe used as the input configuration file for doxygen.Using an example of usage of the Atmel AVR UC3 GPIO driver module as an example,for an Atmel AT32UC3C-EK board, the associated doxyfile.doxygen file is under theavr32/drivers/gpio/peripheral_bus_example/at32uc3c0512c_uc3c_ek/doxygen/ folder.Run doxygen and use this doxyfile.doxygen as configuration file for doxygen.Using the command line, this is done with the following command:doxygen doxyfile.doxygenThe documentation entry file is:avr32/drivers/gpio/peripheral_bus_example/at32uc3c0512c_uc3c_ek/doxygen/html/index.html16 Atmel AVR4029Atmel AVR4029 6 Getting started with ASF and GNU makefile6.1 Install1. Download the Atmel ASF standalone archive (zip file) from/asf.2. Extract the ASF standalone archive on your hard drive.3. Install Atmel AVR Studio® 5 (/avrstudio5) for the compilingand programming tools.4. The software framework build system assumes that you have some basicsoftware tools installed on the build machine. These tools are easy to install onmost modern operating systems. On Microsoft® Windows systems these softwareapplications are installed with the WinAVR package for 8-bit AVR(/) and with the Atmel AVR GNU toolchain(/dyn/products/tools_card.asp?tool_id=4118) for 8-bit and32-bit users, while on Linux® systems they are usually available using thedistributions package system. Software which must be installed for the softwareframework to be useful:•make, sed, grep, sort, tac, bc, etc., often referred to as build essentials•sh – command interpreter (shell)6.2 Header files updateFor 8-bit AVR users it is recommended to update the toolchain header files, adescription about how to do that is located in the readme.txt file under thexmega/utils/header_files/ directory.For Atmel AVR UC3 users, it is recommended to update the IAR header files, adescription about how to do that is located in the readme.txt file under theavr32/utils/header_files/ directory.6.3 Navigating in the ASF standalone archiveThe top folder organization is as follow:•The avr32/ folder contains software modules (source code and projects) dedicatedto AVR UC3 devices•The mega/ folder contains software modules (source code and projects) dedicatedto Atmel megaAVR devices•The xmega/ folder contains software modules (source code and projects)dedicated to Atmel AVR XMEGA devices•The common/ folder contains software modules (source code and projects) sharedby all Atmel AVR devices•The thirdparty/ folder contains software modules (source code and projects) fromthirdparty providers for all AVR devicesThe thirdparty/ folder is organized by thirdparty software module (that is, one folderper thirdparty software module).The avr32/, xmega/ and common/ folders are organized as follow:•The drivers/ folder contains low-level software drivers for AVR on-chip resources(for example, cpu, usart, adc drivers)•The boards/ folder contains board-specific source code files17•The utils/ folder contains files that are used by all other modules: it holds severallinker script files, IAR & GCC pre-compiled libraries of some Atmel ASF modules,and C/C++ utility files with general usage defines, macros and functions•The services/ folder contain application-oriented pieces of software that are notspecific to boards or chips (for example, FAT, TCP/IP stack, OS, JPEG decoder).For the common/ top folder, the services/ folder also contains chip-specific code•The components/ folder offers, for each supported hardware component, asoftware interface to interact with the component (for example, memories likeSDRAM, SD card, or display)•The applications/ folder contains hefty examples of applications using servicesand drivers6.4 Start ASF examplesUsing an example of usage of the Atmel AVR UC3 GPIO driver module as anexample, the GCC projects are located under:•avr32/drivers/gpio/peripheral_bus_example/at32uc3a0512_evk1000/gcc/ for anAtmel EVK1100 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3a0512_evk1105/gcc/ for anAtmel EVK1105 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3b0256_evk1101/gcc/ for anAtmel EVK1101 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3a3256_evk1104/gcc/ for anAtmel EVK1104 board•avr32/drivers/gpio/peripheral_bus_example/at32uc3l064_stk600-rcuc3l0/gcc/ foran Atmel STK600-RCUC3L0 setup•avr32/drivers/gpio/peripheral_bus_example/at32uc3c0512c_uc3c_ek/gcc/ for anAtmel AT32UC3C-EK board•avr32/drivers/gpio/peripheral_bus_example/at32uc3l064_uc3l_ek/gcc/ for anAtmel AT32UC3L-EK boardEach gcc/ folder contains a GCC project with:• a makefile• a project configuration file config.mk18 Atmel AVR4029Atmel AVR402919 Figure 6-1. GNU makefile project location in the ASF.6.5 Building the projectTo build an application, simply enter the appropriate project directory (/gcc folder) and type make.For example, for the Atmel AT32UC3A0512 GPIO peripheral bus example running on Atmel EVK1100 board, typing make in the avr32/drivers/gpio/peripheral_bus_example/at32uc3a0512_evk1100/gcc folder will result:$ makeMKDIR avr32/drivers/intc/CC avr32/drivers/intc/intc.oMKDIR avr32/drivers/gpio/CC avr32/drivers/gpio/gpio.oMKDIR avr32/drivers/gpio/peripheral_bus_example/CC avr32/drivers/gpio/peripheral_bus_example/gpio_peripheMKDIR avr32/utils/startup/AS avr32/utils/startup/startup_uc3.oAS avr32/utils/startup/trampoline_uc3.oAS avr32/drivers/intc/exception.oLN avr32_drivers_gpio_peripheral_bus_example_evk1100.elfSIZE avr32_drivers_gpio_peripheral_bus_example_evk1100.elfavr32_drivers_gpio_peripheral_bus_example_evk1100.elf :section size addr.reset 0x2004 0x80000000.text 0x134 0x80002004.exception 0x200 0x80002200.rodata 0xa0 0x80002400.dalign 0x4 0x4.bss 0xf0 0x8.heap 0xef08 0xf8.comment 0x30 0x0.debug_aranges 0x158 0x0.debug_pubnames 0x3ad 0x0.debug_info 0x11ca 0x0.debug_abbrev 0x554 0x0.debug_line 0x1b6f 0x0.debug_frame 0x294 0x0.debug_str 0x8f0 0x0.debug_loc 0x408 0x0.debug_macinfo 0x2b7053 0x0.stack 0x1000 0xf000.debug_ranges 0x170 0x0Total 0x2cdce5text data bss dec hex filename0x23d8 0x0 0xfffc 74708 123d4 avr32_drivers_gpio_pere_evk1100.elfOBJDUMP avr32_drivers_gpio_peripheral_bus_example_evk1100.lssNM avr32_drivers_gpio_peripheral_bus_example_evk1100.symOBJCOPY avr32_drivers_gpio_peripheral_bus_example_evk1100.hexOBJCOPY avr32_drivers_gpio_peripheral_bus_example_evk1100.binThe result of the build is located in the same folder as the makefile location:•Elf file (.elf)•Listing file (.lss)•Symbol file (.sym)•Hex file (.hex)•Binary file (.bin)6.6 Programming6.6.1 Windows users6.6.1.1 GUI-based solution•Launch Atmel Studio•Select “File->Open->Open Object File for Debugging” and select the generated.elf file. Select “Next”•In the “Device Selection” menu, select the corresponding MCU. Click “Finish”•The project is now available to program and debug. Refer to Atmel Studio gettingstarted and user guide from the welcome screen6.6.1.2 Command-line based solution for AVR Users•Program utilities are installed with Atmel Studio•Use atprogram.exe (e.g. in C:\Program Files (x86)\Atmel\Atmel Studio 6.0\avrdbg)as a programmer•For example to program an at32uc3b0512 with a JTAGICE3 debugger:atprogram -t jtagice3 -i jtag -d at32uc3b0512 program -f e:\file.elfC:\Program Files (x86)\Atmel\Atmel Studio 6.0\avrdbg>atprogram.exeAVR Studio Command Line InterfaceCopyright (C) 2011 Atmel Corporation.Usage: atprogram [options] <command> [arguments] [<command> [arguments] ...]Options:-t --tool <arg> Tool name: avrdragon, avrispmk2, avrone, jtagice3,jtagicemkii, qt600, stk500, stk600 or samice.-s --serialnumber <arg> The programmer/debugger serialnumber. Must be20 Atmel AVR4029Atmel AVR4029specified when more than one debugger isconnected.-c --comport <arg> The com port to use for the programmer/debugger.e.g. -c COM1 or -c 1-i --interface <arg> Physical interface: aWire, debugWIRE, HVPP, HVSP,ISP, JTAG, PDI or TPI.-d --device <arg> Device name. E.g. atxmega128a1 or at32uc3a0256.-v --verbose Verbose output (debug).-h --host <arg> Target host which runs the avrdbg process.-p --port <arg> Specify which port to use for the avrdbg process.Ignored if the host option is not given.-f --force Force command even if firmware is not up to date.-cl --clock <arg> The frequency to use for communication with adevice (hz, khz, mhz, default hz). E.g. -cl 10mhz-mb --max-baudrate <arg> The maximum baud rate for communication on awire(Kbps).-xr --externalreset Apply external reset when starting a session.-dc --daisychain <args,..> Set up a JTAG daisychain. Arguments are <devices-before devices-after instr-before instr-after>.-tv --target-voltage <arg> Set the STK600 or STK500 target voltage (floatvalue).-a0 --aref0 <arg> Set the STK600 Aref0 or STK500 aref generatorvoltage (float value).-a1 --aref1 <arg> Set the STK600 Aref1 generator voltage (floatvalue).-cg --clock-generator <arg> Set the STK600 or STK500 Clock generator frequenc(hz, khz, mhz, default hz).--timeout <arg> Set the timeout value in seconds for commands. Thedefault is 180 seconds. Set to 0 for no timeout.-q --quiet Do not display activity indicator.-? --help Display help information.Commands:chiperase Full erase of chip.erase Erase the specified memory.help Displays help for a specific command.info Display information about a device.list Detect and print information about connected Atmel Tools.program Program device with data from <file>.read Read the contents of the memory on the device.secure Set the security bit on UC3 and ARM devices.verify Verify content of memory based on a file.version Display the version.write Write to the memory with values entered on the command line.21 8431C-AVR-03/20136.6.1.3 Command-line based solution for SAM UsersRefer to Atmel SAM-BA® In system programmer:/tools/ATMELSAM-BAIN-SYSTEMPROGRAMMER.aspx6.6.2 Linux users•For 8-bit users, use AVRDUDE for MCU programming.(/avrdude/)•For 32-bit AVR users, refer to “AVR32 Studio Users” section for a GUI-basedsolution•For ARM users, refer to SAM-BA In System programmer(/tools/ATMELSAM-BAIN-SYSTEMPROGRAMMER.aspx)6.7 AVR32 Studio users32-bit AVR users can use Atmel ASF GNU makefile in 32-bit Atmel AVR Studio. It ispossible to work with an unzipped ASF package from within 32-bit AVR Studio: this isdescribed in the application note "AVR32769: How to Compile the standalone AVR32Software Framework in AVR32 Studio V2":/dyn/resources/prod_documents/doc32115.pdf.6.8 Access to project documentation6.8.1 Online DocumentationAll ASF module and reference application Doxygen documentation can be found on.6.8.2 Offline DocumentationAll modules are fully documented using doxygen tags. Each project within the ASFcontains a doxyfile.doxygen (used to configure doxygen for a proper documentationgeneration): to generate the html documentation, doxygen must be installed (see/download.html) and the doxyfile.doxygen must be used asthe input configuration file for doxygen.Using an example of usage of the Atmel AVR UC3 GPIO driver module as an example,for an Atmel AT32UC3C-EK board, the associated doxyfile.doxygen file is under theavr32/drivers/gpio/peripheral_bus_example/at32uc3c0512c_uc3c_ek/doxygen/ folder.Run doxygen and use this doxyfile.doxygen as configuration file for doxygen.Using the command line, this is done with the following command:doxygen doxyfile.doxygenThe documentation entry file is:avr32/drivers/gpio/peripheral_bus_example/at32uc3c0512c_uc3c_ek/doxygen/html/index.html22 Atmel AVR40298431C-AVR-03/2013。

AtmelStudio-6.0简易入门教程(精炼实用)

AtmelStudio-6.0简易入门教程(精炼实用)

一、建议工程文件AtmelStudi6.0这个全新的环境使用起来极其不顺手,因为首先我对AtmelStudio以前的版本也根本没有使用经验,就根据很陌生,其次,这个新版本软件还根本没有人用,根本没有任何的相关教程资料,唯一可以参考的只是官网的比较简单的视频教程,还是英文讲解,反正没怎么搞透。

不过还是硬着头皮用下去,因为软件是免费的,而且当后来我知道代码编辑环境其实就是微软VS环境的时候,我就更不犹豫了,大家应该都了解VS的代码编写环境是很智能的,尤其自动补全功能。

现在,我已经能很熟练的使用AtmelStudio6.0软件了,随着使用我也更加喜欢玩AVR单片机做一些小作品了,而不再用普通51和STC了。

当使用熟练以后也就感觉到其实这个免费智能的编译环境其实是很简单的,那现在我就帮助更多喜欢使用AVR而没用使用AtmelStudio软件的同学们轻松越过这一个门槛,进入一个美好的编程世界。

该软件的不足之处:一是软件相对较大,打开比较慢,但是运行还是比较顺利的;二是不支持山寨仿真器,这可苦了没钱的劳苦电工们了。

(不过我都是用ISP烧录调试,一般不用仿真)最下面附件有一个简单的LED_test工程文件,编译通过的。

大家可以试用。

下面开始介绍的软件工程的建立。

1. 软件总界面总体界面还是比较简洁的,和其他编译软件都是差不多的,而且和KEIL软件的界面是很相似的,使用很方便。

2. 新建工程新建工程很简单:FILE->NEW->Project 然后就看到下面的新建工程界面了,选择第一个GCC C Executable工程就可以,第二个GCC C static Library 是用来新建 .h文件的。

然后下面蓝圈1是C文件的名称,蓝圈2 Solution Name 是工程的文件,中间的Location是文件存放位置,自己选择合适的位置即可。

点击下面的OK3. 下面接着是单片机型号选择界面,选择合适的单片机就可以了。

preps6.0详细教程

preps6.0详细教程

Preps6.0相比之前的版本有了较大改动,它将之前的模版、作业、ganging都整合到了一起,相比之前确实是方便了不少;而软件界面也有较大改观,不再像之前那么简洁,但实用性却大大增加。

Preps的改动使之前教程已经不再适用,特别是对于初学者来说,用着6.0看着之前的教程几乎不能学会。

所以本人制作了此教程,特别适合于初学者,本人因为用不到这个软件也只是研究了一天,如有不到之处还请高手赐教,并及时改正,以免误导他人。

软件界面
新建板材
新建纸张
新建标记
1.胶装书实例
1
2
输出纸张尺寸输出板材尺寸
2.利用占位符拼散板
效果如图
Ok!完成!
感谢大家耗费这么长时间观看我的教程。

头一次做这样的教程,如有不到之处敬请谅解!
祝大家学习愉快!!。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

一、建议工程文件AtmelStudi6.0这个全新的环境使用起来极其不顺手,因为首先我对AtmelStudio以前的版本也根本没有使用经验,就根据很陌生,其次,这个新版本软件还根本没有人用,根本没有任何的相关教程资料,唯一可以参考的只是官网的比较简单的视频教程,还是英文讲解,反正没怎么搞透。

不过还是硬着头皮用下去,因为软件是免费的,而且当后来我知道代码编辑环境其实就是微软VS环境的时候,我就更不犹豫了,大家应该都了解VS的代码编写环境是很智能的,尤其自动补全功能。

现在,我已经能很熟练的使用AtmelStudio6.0软件了,随着使用我也更加喜欢玩AVR单片机做一些小作品了,而不再用普通51和STC了。

当使用熟练以后也就感觉到其实这个免费智能的编译环境其实是很简单的,那现在我就帮助更多喜欢使用AVR而没用使用AtmelStudio软件的同学们轻松越过这一个门槛,进入一个美好的编程世界。

该软件的不足之处:一是软件相对较大,打开比较慢,但是运行还是比较顺利的;二是不支持山寨仿真器,这可苦了没钱的劳苦电工们了。

(不过我都是用ISP烧录调试,一般不用仿真)最下面附件有一个简单的LED_test工程文件,编译通过的。

大家可以试用。

下面开始介绍的软件工程的建立。

1. 软件总界面总体界面还是比较简洁的,和其他编译软件都是差不多的,而且和KEIL软件的界面是很相似的,使用很方便。

2. 新建工程新建工程很简单:FILE->NEW->Project 然后就看到下面的新建工程界面了,选择第一个GCC C Executable工程就可以,第二个GCC C static Library 是用来新建 .h文件的。

然后下面蓝圈1是C文件的名称,蓝圈2 Solution Name 是工程的文件,中间的Location是文件存放位置,自己选择合适的位置即可。

点击下面的OK3. 下面接着是单片机型号选择界面,选择合适的单片机就可以了。

4. 下面就看到真正的代码编辑界面了,软件会智能的添加工程文件说明信息,并提供简单的main 函数代码,比较好。

在代码编辑区编写你的实现代码即可。

5. 大家可能看到上面中文注释部分由让人不喜欢的下划波浪线,下面告诉你怎么除掉它。

VAssistX –> Visual Assist X options 然后underlines 选择min即可,如下图6. 对于软件环境的工具栏常用按键下面简单说一下,如下图。

(1) 圈1:就是编译按钮和KEIL的按键是一样的(2) 圈2:是单片机型号选择,这个不同平台之间移植要首先修改单片机型号,不然会出错,这个也是本软件的一个优点,这样就AVR所有的单片机系列之间可以轻松的移植,如果遇到寄存器变化,编译的时候就会出错,提示你修改(3) 圈3:就是注释和缩进快捷按钮也是编写代码比较常用的7. 下面介绍一些使用atmelstudio6.0需要注意的一下事项。

这些事项很重要,不然会导致你无法编译成功,这些事项其实是从网上一篇文章《从ICC AVR 到Atmel Studio 6》中摘录的,一直不知道这位大侠是谁,在这里先向这位无私的大侠致敬,如果该大侠看到该我的文章,如果有不同意还请告诉我。

注意事项整理如下:1) MCU必须的头文件Atmel Studio 6 (以下简称AS6)中统一用#include <avr/io.h>。

这点很重要,AS6把atmel所有的单片机头文件全都集成在一起了,以后不必再去分具体的每种芯片的头文件了2) 汇编嵌入在AS6 中,你可以直接使用asm("xxx")格式.或者用小写的sei();这个其实是很爽的,最常用的就是中断控制,使用比较方便。

3) 延时函数在AS6中,只需要加载一个头文件#include <util/delay.h>,就可以使用两个标准的延时函数,分别是_delay_ms(double __ms)和_delay_us(double __us),虽然参数为double型,但可赋整型值。

注意在调用前定义#define F_CPU 8000000UL,如下图,这样延时10ms的函数写为_delay_ms(10),经过试用,只要晶振填写准确,这两个延时函数很准确。

4) 中断函数在AS6中,需加载头文件#include <avr/interrupt.h>,并且函数名为ISR,不可自定义函数名,格式如下:ISR( TIMER0_OVF_vect ){…}TIMER0_OVF_vect 含义同iv_TIMER0_OVF ,是T0溢出中断号。

不同型号mcu的中断向量号的名称不同,A6的中断向量号请从avr/iomXXX.h中查找。

5) EEPROM操作函数在ICC中加载头文件#include <eeprom.h>后,可以使用如下两个读写函数:EEPROM_read(addr, var); //读EEPROM中的一个字节EEPROM_write (addr, var); //向EEPROM中写入一个字节6) 定义数据在flash区主要用于在字符点阵或图形点阵数据存放在flash区,这样可以减少data区的使用,不至于使data区溢出。

在AS6中,需加载头文件#include <avr/pgmspace.h>,然后用PROGMEM 。

举例说明:PROGMEM const unsigned char flash[10];在flash区声明一个unsiged char型的数组,成员个数10。

unsigned char a;a = pgm_read_byte(flash[0]);把flash [0]值赋给变量a。

而a = flash[0]是不会从flash区读数据的,而是读data区的数据。

二维数组: PROGMEM const unsigned char flash[3][10]={……};指针数组: PROGMEM const unsigned char* const flash[3]={……};二、工程文件的优化设置点击工程项目,properties 进行设置定位代码地址,bootloader是必须的,其它程序也可能需要在“属性”里设置晶振频率(这也是预设计的#define...)设置头文件路径设置需要生成的文件(设置生成文件hex)设置优化率添加自定义库更换为WinaAvr 编译条件的设置设置芯片设置仿真器(我没有使用仿真器,设置为Simulator)三、从ICC_A VR_到_Atmel_Studio_6以前一直在用ICCA VR 感觉生成文档方便,现在发现了Atmel Studio 6, 因为偶尔会用C#(VS2010)所以一下子就喜欢上了这个编译器,我只用8bit 的A VR 另外也是刚刚接触,所以在移植过程中会遇到各种问题,以下是自己的一些问题写出来共大家参考;1.MCU必须的头文件例如在ICC A VR(以下简称ICC)中使用#include <iom16v.h>或#include <iom128v.h>,要根据不同的mcu 型号选择头文件。

而在Atmel Studio 6 (以下简称AS6)中统一用#include <avr/io.h>。

(ICC A VR 7 的版本中也可以用统一的头文件了)2.头文件<macros.h>在ICC 中,头文件<macros.h>包含#include <A VRdef.h>。

在A VRdef.h 中,宏定义了一些常用的汇编指令和一些不常用的函数。

例如:(详细内容请参考ICC 安装程序中A VRdef.h)#define WDR() asm("wdr")#define SEI() asm("sei")#define CLI() asm("cli")#define NOP() asm("nop")#define SLEEP() asm("sleep");#define _WDR() asm("wdr")#define _SEI() asm("sei")#define _CLI() asm("cli")#define _NOP() asm("nop")#define _SLEEP() asm ("sleep");#define BIT(x) (1 << (x));在A S6 中,你可以直接使用asm("xxx")格式.或者用小写的sei();(当然要包含相应的头文件);Ps:如果移植ICC的代码比较麻烦,可以将这些宏命令添加到一个总的头文件(include.h) 中,所有c 文件都引用include.h,那么在移植过程中,将不需要修改代码。

3.延时函数在ICC中,delay延时函数,需要自己写,往往不准。

而在AS中,只需要加载一个头文件#include <util/delay.h>,就可以使用两个标准的延时函数,分别是_delay_ms(double __ms)和_delay_us(double __us),虽然参数为double型,但可赋整型值。

注意在调用前定义#define F_CPU 16000000UL(我也不知道为什么要加UL),这样延时10ms的函数写为_delay_ms(10)。

4.中断函数例如T0 溢出中断,在ICC 中如下定义:#pragma interrupt_handler timer0_ovf_isr:iv_TIMER0_OVFvoid timer0_ovf_isr(void) {…}timer0_ovf_isr 这个函数名是自定义的。

而在A6中,需加载头文件#include <avr/interrupt.h>,并且函数名为ISR,不可自定义函数名,格式如下:ISR( TIMER0_OVF_vect ){…}TIMER0_OVF_vect 含义同iv_TIMER0_OVF ,是T0溢出中断号。

不同型号mcu的中断向量号的名称不同,A6的中断向量号请从avr/iomXXX.h中查找。

5.EEPROM操作函数在ICC中加载头文件#include <eeprom.h>后,可以使用如下两个读写函数:EEPROM_read(addr, var); //读EEPROM中的一个字节EEPROM_write (addr, var); //向EEPROM中写入一个字节在AS6中,加载头文件#include <avr/eeprom.h>后,可以使用如下两个读写函数:_EEGET(var, addr) ; //读EEPROM中的一个字节_EEPUT(addr, var) ; //向EEPROM中写入一个字节Ps:为了移植时不修改代码,我的做法是在总的头文件(include.h)中添加以下宏定义:#define EEPROM_read(addr, var) _EEGET(var, addr)#define EEPROM_write (addr, var) _EEPUT(addr, var)6.定义数据在flash区主要用于在字符点阵或图形点阵数据存放在flash区,这样可以减少data区的使用,不至于使data区溢出.在ICC中,用const关键字定义变量,并在ICC软件设置项中,勾选treat "const" as __flash即可。

相关文档
最新文档