大数据可视化培训中心学习时间是多久?

本店售价:¥55.00
本店售价:¥178.00
本店售价:¥138.00
本店售价:¥1.50
本店售价:¥219.00
本店售价:¥387.00
本店售价:¥298.00
本店售价:¥398.00
本店售价:¥179.00
本店售价:¥178.00
本店售价:¥349.00
本店售价:¥119.00
本店售价:¥764.00
& 【创客学堂】Arduino M0 Pro使用Ardino IDE与Atmel studio实现在线调试
【创客学堂】Arduino M0 Pro使用Ardino IDE与Atmel studio实现在线调试
编辑:Salmon
浏览次数:319
1.&Arduino M0 Pro功能简介
Arduino&M0 Pro开发板旨在为人们在智能物联网设备、可穿戴技术、高科技自动化、机器人技术以及其他创意项目中提供可用平台。该产品有助于开发新项目,非常适合作为学习32位应用程序开发的教学工具。
&&&&&&&&&&
32位ARM Cortex& M0+内核的低功耗 Atmel SAMD21 微控制器,Arduino&M0 Pro 开发板扩充了Arduino&开发板系列,性能进一步增强,功能更强大。该开发板的一个主要特色是配备了 Atmel 的嵌入式调试器 (EDBG),该调试器提供一个完整的调试接口,而且无需其它硬件,从而大幅提升了软件调试的便捷性。EDBG 还支持一个虚拟的 COM 端口,可以用于为设备编程,并实现传统的Arduino引导装载程序功能。
该款开发板兼容遵从&ArduinoR3 布局的 3.3VShield,借助一个被集成到Arduino开发环境中的定制开发软件库,全面支持使用Arduino编程语言对Arduino M0 Pro进行开发。
M0 Pro 的主要硬件规格包括封装于48针 LQFP 中的48赫兹 ATSAMD21G18 微控制器、3.3V电压、256KB闪存、32KB SRAM 和 16KB 仿真 EEPROM。输入/输出功能包括带有12 PWM 通道和 UART 的14个数字式I/O插针,6个12位 ADC 输入通道和一个10位的 DAC 输出。
2.&Arduino M0 Pro控制器使用方法
&&&&&&&&&&
&图3 Arduino M0 Pro主要接口&&
Arduino M0 Pro提供了两个Mini USB。其中靠近电源接口的是EDBG USB可以在线调试和串口通讯,而原生USB接口只能上传程序。
3.&Arduino IDE软件使用方法
1)下载最新的Arduino IDE,在Arduino IDE文件夹中找到找到drivers文件夹,找到&driver-atmel-bundle-7.0.712.exe双击安装,安装完成后,再找到dpinst-x86.exe双击安装。
2) 将Arduino M0 Pro板的EDGE Mini USB接口用USB线连接到计算机,安装驱动后系统自动识别一个Atmel EDBG Data Gateway和一个虚拟串口EDBG Virtual COM Port(COM号)。
在设备管理器中如图所示:
图4 EDGE Virtual COM Port在windows资源管理器的显示
3) 将Arduino M0 Pro板的原生Mini USB接口用USB线连接到计算机,安装驱动后系统自动识别一个Arduino M0 PRO Native Port(COM号),在设备管理器中如图所示:
图5 Native Port在windows资源管理器的显示
4)配置ArduinoIDE环境。
Arduino M0 Pro板的Mini USB接口与计算机连接,在Arduino IDE中选择【工具】&【板】&【Arduino M0 Pro(Native Port)】,此接口上传速度程序相对慢一些。
Arduino M0 Pro板的EDGE Mini USB接口与计算机连接,在Arduino IDE中选择【工具】&【板】&【Arduino M0 Pro(Programming Port)】,此接口上传程序速度相对较快。
注意对应接口要对应板卡里的编程接口,两个接口都可以上传程序。
图6 Programming Port端口设置&&&&&&&&&&&&&&&&&&&&&&&& &&图7&Native USB Port端口设置
4.在线调试Arduino程序过程
1)设置Arduino首选项
图8 Arduino IDE设置首选项菜单
2)在显示详细输出后面的编译选择上。
图9 首选项选项卡
3)我们需要一块MO Pro的板子、一块扩展板、一个LED小灯、一根3P接线和一根USB线来辅助调试
图10 辅助调试所需硬件
4)打开要在线调试的程序,选择Arduino提供的例子blink,正常编译下载程序,完成后在提示区找到Blink.cpp.elf文件位置。
图11 ArduinoIDE显示详细输出窗口
5)将LED灯接在拓展板D13引脚上,之后将拓展板插到MO Pro上
图12 辅助调试硬件连接
6)找到C:\Users\Administrator\AppData\Local\Temp\build0126787.tmp\Blink.cpp.elf,将文件路径复制下来。
7)在线调试必须安装Atmel Studio,启动Atmel Studio在File下拉菜单Open的下级菜单中找到Open Object File For Debugging。
图13 Atmel Studio&打开调试文件菜单
8)将刚才在Arduino IDE中找到的Blink.cpp.elf文件目录位置复制到Select the Object File to Debug的输入框里,选择下一步。
图14 &Atmel Studio打开文件选项卡
9)在device selection下拉列表中选择芯片型号ATSAND21G18A,然后选择Finish完成设置。
图15 芯片选择选项卡
10)在弹出的Remap Object To Desk Files选项卡中点击第一条输入框中的文件位置,找到刚才编译的Blink.ino原文件。
&&& 图16 调试文件选项卡&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&图17 选择Blink.ino文件对话框
11)在Solution Explorer中左键选择Blink.ino文件后,在右键菜单中选择打开。
图18 Solution Explorer资源窗口
12)在Blink程序中设置断点。
选择设置断点的语句所在的行首,在右键菜单中选择Breakpoint下级菜单中的insertBreakpoint。
图19 Atmel Studio Blink文件窗口
13)设置完断点后,如图所示。
图20 设置断点菜单
图21 程序断点设置
图22 程序断点设置结构
14)在设置完要调试的断点后,点选调试,弹出调试工具对话框,在对话框中Selected debgger/programmer下拉列表中选择EDGB FFFFFFFFFF FFFFFFFFFF。再次选择调试。
图23 选择调试设备对话框
15)执行一次Start Debgging,程序就会运行到下一个设置的调试断点。
图24 开始调试状态
16)可以在IO View资源框中直观看到端口的状态。
图25 IO View 资源窗口
17)在相应断电处,LED灯随着在线调试而点亮和熄灭。
图26 调试到第一断点,LED小灯点亮
图27 调试到第二断点,LED小灯熄灭
5.在线调试Arduino程序实例
通过以上的讲解大家是否已经初步了解Arduino&M0 Pro的优势所在了呢,下面我们通过一个更复杂的程序与结构来更深入的了解一下Arduino&M0 Pro的在线调试功能。
1)&在调试前准备了一个自己DIY的小玩具工艺品,还有Arduino&M0 Pro一块,外加一些线材,小工艺品中包括一个超声波模块、一个360°舵机。
图28 所需设备
2)&调试之前需将各个设备连接好,电机接到D10接口,超声波传感器接到A1接口。
图29 调试前按图连接好各设备
3)按照上文,将程序用Atmel Studio打开后,进行到在线调试的步骤。
4)在程序中设置两个断点
图30 设置两个断点,舵机旋转速度不同
5)当程序运行到第一断点时,Arduino&M0 Pro控制舵机转速为1580,舵机此时旋转速度相对较慢。
图31 调试到第一断点,舵机旋转速度为1580
图32 此时舵机旋转相对较慢,动画放映慢
6)当程序运行到第二断点时,Arduino&M0 Pro控制舵机转速为2000,舵机此时旋转速度相对较块。
图33 调试到第二断点,舵机旋转速度为2000
图34 此时舵机旋转相对较快,动画放映快
至此完成了Arduino M0 Pro控制板简单的在线调试过程,我们通过在线调试可以更加直观的了解程序的执行过程并了解硬件的运行状态。
奥松机器人官网:
微信号:搜索公众号“奥松机器人”
QQ群: (讨论,解惑)
微博:@奥松机器人基地
----------------------------------------------------------------------------------------------------------------
温馨提示:予人玫瑰,手留余香;如果你喜欢这篇文章,不妨转发推荐给你身边的朋友!
相关文章:
总计 0 个记录,共 1 页。
关注奥松机器人微信
为您提供新鲜资讯、优惠信息
哈尔滨公司地址:黑龙江哈尔滨香坊区衡山路18号远东大厦B区10层
深圳公司地址:深圳市龙岗区黄阁路天安数码城2栋B座301
Hi,大家好,我是小奥!
欢迎来到奥松机器人的世界!
需要咨询服务请点小奥哦!
销售咨询:
销售咨询:
技术支持:
咨询电话:Arduino入门3: 安装和熟悉Arduino IDE - 脑震荡
Arduino入门3: 安装和熟悉Arduino IDE
Arduino官方为开发Arduino程序专门提供了跨平台的Arduino集成开发环境—Arduino IDE。它的原始框架基于Casey Reas与Ben Fry写的互动编程软件Processing,使用Java编写。Arduino IDE区别于其它高级的IDE,它一开始的目标用户就是那些不懂软件开发的初学者和艺术家。所以它的用户界面非常“简单”,支持包括C和C++,简单的语法高亮,自动缩进等特性。
本作品采用进行许可。
本教程系列是专门面向零基础的Arduino初学者,让初学者不仅对Arduino的历史,原理操作有基本的入门,而且对Arduino背后所代表的观念和思潮运动有所理解。脑震荡原创内容,请尊重作者的知识产权。
在上一篇《》中我们了解了Arduino的构成,种类还有如何选择适合自己的Arduino硬件。在本篇教程中,我们来关注一下Arduino的软件端。
什么是Arduino IDE
IDE是Integrated Development Environment,中文译为集成开发环境,是用于提供程序开发环境的应用程序,通常包括了程序开发的一系列工具链,包括代码的编辑器、编译器、调试器和图形用户界面工具等。常见的IDE比如微软的,苹果的,等。
Arduino IDE
Arduino官方为开发Arduino程序专门提供了跨平台的Arduino集成开发环境—Arduino IDE。它的原始框架基于Casey Reas与Ben Fry写的互动编程软件,使用Java编写。Arduino IDE区别于其它高级的IDE,它一开始的目标用户就是那些不懂软件开发的初学者和艺术家。所以它的用户界面非常“简单”,支持包括C和C++,简单的语法高亮,自动缩进等特性。
Arduino IDE引入了“sketch”的概念,所谓的sketch,狭义上来说一个sketch是一个Arduino程序文件,IDE 1.0前是以.pde后缀结尾的,1.0及以上改为.ino后缀。广义上来说sketch带有一点“草稿”,“实验”的意味,“Sketching in Hardware”就是利用快速的硬件原型迭代来学习和理解产品开发的一种方法论。
近段时间,Arduino官方又尝试推出,本地无需安装任何软件,所有的开发和编译都利用Web技术完成。当然Web IDE和本地安装的IDE各有利弊,以后我们另外再详细比较。
Arduino IDE并不是唯一可以给Arduino编写和烧录程序的集成开发环境,随着Arduino普及和流行,很多主流IDE都提供了相关的插件和功能,让很多熟悉高级IDE的人,在不离开熟悉的开发环境的情况下也能开发Arduino应用。
比如就是一款能让Atmel Studio和Visual Studio支持Arduino开发的扩展插件。是另一款让Xcode支持Arduino的扩展插件。
安装Arduino IDE(Windows系统)
这个小节里我们演示一下在Windows系统上怎么连接Arduino和电脑,安装Arduino IDE,然后上载你的第一个程序。
1. 准备好Arduino/ Genuino开发板和USB线
我们这里用的是最新的Arduino/Genuino UNO,如果你使用的是老版本的Arduino Duemilanove, Nano或者Diecimila 请参考“老版本Arduino的驱动安装”一章。
你还需准备一根标准的USB线,一端是USB A型口,另一端是B型口。
图片为Arduino IDE界面
2. 下载安装Arduino IDE
在Arduino的下载最新版的Windows版,注意这里有Windows Installer和Windows Zip文件两个选择,脑叔推荐用Windows Installer安装,这样电脑会自动安装相关驱动,但你必须拥电脑的安装程序权限。如果你选择Zip压缩包文件,你需要手动安装Arduino的驱动程序。
安装流程非常简单,这里就不赘述了。如果安装成功了,你的桌面就会生成Arduino IDE的桌面快捷图标。如果是Zip压缩包,解压后文件夹里你会发现Arduino的启动器。
3. 连接Arduino和PC电脑
Arduino通过USB连接电脑不但可以给Arduino上传程序还能通过USB给Arduino提供5V的电源。如果连接成功,Arduino板上标记有“PWR”的LED指示灯会亮起。
4. 安装Arduino驱动
如果你用Windows Installer安装同时你的系统是XP及XP以上至Window 10,只要你连接好Arduino,系统会自动搜索并安装驱动。
但如果你下载的是Zip压缩包,或者由于某些原因,你的Arduino无法被系统正确识别,你可以参考以下步骤手动安装程序:
点击“开始”菜单,打开“控制面板”
在“控制面板”下,点击“系统和安全”选项,下一步,点击“系统”。“系统”窗口出现后,打开“设备管理器”
找到”设备管理器”列表中的“端口(COM & LPT)”选项,你应该能看到一个名为“Arduino UNO(COMxx)”的端口。如果没有“端口(COM & LPT)”选项,找找“其它设备”中的“未知设备”
右键点击“Arduino UNO(COMxx)”的端口,选择“更新驱动程序”
下一步,选择“浏览计算机以查找驱动程序软件”
最后,在解压的Arduino文件夹的子文件夹“Drivers”里,选择“arduino.inf”,Windows就可以安装好所需的驱动文件了。
5. 打开Arduino IDE
双击Arduino的桌面快捷方式,或者arduino.exe。
6. 打开Blink实例
从“File & Examples & 01.Basics & Blink ” 打开Blink实例
7. 匹配正确的Arduino版本
IDE无法自动得知你正在使用哪一种版本的Arduino,这个过程是手动的。在“Tools & Board”下面选择对应的“Arduino/Genuino Uno”(如果你使用的是其它版本,请选择相应的版本)。
8. 选择正确的端口
除了选择正确的版本外,还要手动匹配正确的串行通信的端口。在“Tools & Serial Port”下面你可以看到可用的串口。一般来说COM1和COM2是被系统占用的,所以说很多时候是COM3或者更大数字的COMx。通常你可以把Arduino和电脑之间的USB线拔掉再插上,如果哪个COM口消失又出现了,那就是Arduino占用的串口。选择中它就可以了。
9. 上载程序
现在,你只要点击IDE的Toolbar上面第二个带有箭头的“Upload”按钮。等待几秒钟,你应该能看到Arduino板上标有RX和TX的黄色指示LED在狂闪,说明IDE在烧录程序,如果上载成功,你在状态栏里应该会看到“Done uploading”的提示,否则会提醒上载失败及原因。
上载成功结束后,如果你看到与D13 PIN相连的板载LED一闪一闪发着黄光,那么恭喜你,你成功安装了Arduino,而且成功地完成了一次程序上载的实践!
安装Arduino IDE(Mac OS系统)
这个小节里我们演示一下在Mac OS系统上怎么连接Arduino和电脑,安装Arduino IDE,然后上载你的第一个程序。
1. 准备好Arduino/ Genuino开发板和USB线
我们这里用的是最新的Arduino/Genuino UNO,如果你使用的是老版本的Arduino Duemilanove, Nano或者Diecimila 请参考“老版本Arduino的驱动安装”一章。
你还需准备一根标准的USB线,一端是USB A型口,另一端是B型口。
图片为Arduino IDE界面
2. 下载安装Arduino IDE
在Arduino的下载最新版的Mac OS版本。下载完成后,系统会自动解压Zip压缩包,你就可以看见Arduino.app
建议你把Arduino.app移到Application里,免得回头找不到Arduino程序。
3. 连接Arduino和Mac电脑
Arduino通过USB连接电脑不但可以给Arduino上传程序还能通过USB给Arduino提供5V的电源。如果连接成功,Arduino板上标记有“PWR”的LED指示灯会亮起。
4. 打开Arduino IDE
双击Arduino.app
5. 打开Blink实例
从“File & Examples & 01.Basics & Blink ” 打开Blink实例
6. 匹配正确的Arduino版本
IDE无法自动得知你正在使用哪一种版本的Arduino,这个过程是手动的。在“Tools & Board”下面选择对应的“Arduino/Genuino Uno”(如果你使用的是其它版本,请选择相应的版本)。
7. 选择正确的端口
除了选择正确的版本外,还要手动匹配正确的串行通信的端口。在“Tools & Serial Port”下面你可以看到可用的串口。一般来说,Mac系统下的串口是以“/dev/tty.”开头的,你可以把Arduino和电脑之间的USB线拔掉再插上,如果哪个端口消失又出现了,那就是Arduino占用的串口。选择中它就可以了。
8. 上载程序
现在,你只要点击IDE的Toolbar上面第二个带有箭头的“Upload”按钮。等待几秒钟,你应该能看到Arduino板上标有RX和TX的黄色指示LED在狂闪,说明IDE在烧录程序,如果上载成功,你在状态栏里应该会看到“Done uploading”的提示,否则会提醒上载失败及原因。
上载成功结束后,如果你看到与D13 PIN相连的板载LED一闪一闪发着黄光,那么恭喜你,你成功安装了Arduino,而且成功地完成了一次程序上载的实践!
安装Arduino IDE(Linux系统)
这个小节里我们演示一下在Linux系统上怎么连接Arduino和电脑,安装Arduino IDE,然后上载你的第一个程序。
1. 准备好Arduino/ Genuino开发板和USB线
我们这里用的是最新的Arduino/Genuino UNO,如果你使用的是老版本的Arduino Duemilanove, Nano或者Diecimila 请参考“老版本Arduino的驱动安装”一章。
你还需准备一根标准的USB线,一端是USB A型口,另一端是B型口。
图片为Arduino IDE界面
2. 下载安装Arduino IDE
在Arduino的下载最新版的Linux版本, 你可以选择与你系统相对应的32位/64位安装包。下载完成,解压tar.xz文件到你想要的文件夹里。
进入 arduino-x.x.x文件夹,找到install.sh文件,右键打开选择“Run in terminal”,然后安装成功后你就发现桌面多了Arduino图标。
如果在右键菜单里没有“Run in Terminal”选项,那你就需要手动打开Terminal窗口,cd命令到arduino-x.x.x文件夹里,然后键入
./install.sh
等待安装完成后,你在桌面就能找到Arduino程序图标。
3. 连接Arduino和Mac电脑
Arduino通过USB连接电脑不但可以给Arduino上传程序还能通过USB给Arduino提供5V的电源。如果连接成功,Arduino板上标记有“PWR”的LED指示灯会亮起。
4. 打开Arduino IDE
双击Arduino桌面图标,就可以打开Arduino IDE
5. 打开Blink实例
从“File & Examples & 01.Basics & Blink ” 打开Blink实例
6. 匹配正确的Arduino版本
IDE无法自动得知你正在使用哪一种版本的Arduino,这个过程是手动的。在“Tools & Board”下面选择对应的“Arduino/Genuino Uno”(如果你使用的是其它版本,请选择相应的版本)。
7. 选择正确的端口
除了选择正确的版本外,还要手动匹配正确的串行通信的端口。在“Tools & Serial Port”下面你可以看到可用的串口。一般来说,Linux系统下的串口是以“/dev/tty”开头的,你可以把Arduino和电脑之间的USB线拔掉再插上,如果哪个端口消失又出现了,那就是Arduino占用的串口。选择中它就可以了。
8. 上载程序
现在,你只要点击IDE的Toolbar上面第二个带有箭头的“Upload”按钮。等待几秒钟,你应该能看到Arduino板上标有RX和TX的黄色指示LED在狂闪,说明IDE在烧录程序,如果上载成功,你在状态栏里应该会看到“Done uploading”的提示,否则会提醒上载失败及原因。
上载成功结束后,如果你看到与D13 PIN相连的板载LED一闪一闪发着黄光,那么恭喜你,你成功安装了Arduino,而且成功地完成了一次程序上载的实践!
Arduino IDE界面
前面我们提到,区别于很多IDE,Arduino IDE的界面为了易用性,如图所示大大简化界面包含的元素:
Arduino编程语法简介
Arduino编程的语法是建立在C语言上的,二次封装简化了很多自己的功能,当然也兼容C和C++。如果你有C/C++的基础,上手Arduino就很容易。
下面是Blink实例的源码,是最典型的Arduino程序的构造。
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH);
// turn the LED on (HIGH is the voltage level)
delay(1000);
// wait for a second
digitalWrite(13, LOW);
// turn the LED off by making the voltage LOW
delay(1000);
// wait for a second
setup()函数是整个程序的入口,主要在这个函数里初始化一些变量,定义Arduino针脚,启用一些库文件函数等。Arduino程序启动时只运行一次setup(),然后进入loop()的不断循环。
loop()函数,顾名思义就是不断循环的一个函数,这是Arduino程序的主体,通过循环来控制整个Arduino的输入和输出。
Arduino所有的函数封装和运算符都可以在官网的语言参考里找到说明:https://www.arduino.cc/en/Reference/HomePage。具体每一个的使用,我们会在以后的教程实例里陆续学习和讲解到,脑叔在此就不在此一一赘述。The Serial Monitor Window - Arduino IDE for Visual Studio and Atmel Studio
The Serial Monitor Window
You can use the Serial Monitor Window to send data via the
connection to your Arduino board and to visualize incoming data from your board.
With the Serial.print() and Serial.read() functions, you can send and
receive data via the serial port. Visual Micro's Serial Monitor is
the PCs counterpart on the other end of the serial line.
You can find the documentation of the Serial... functions on the
To show the Serial Monitor in your IDE, choose vMicro&&&Serial Monitor or click the Serial Monitor button in the
Arduino Communications toolbar:
With the selection box
you choose the COM port your board is connected to.
A good start for experimenting with Arduino's Serial
functions is the
ReadASCIIString example provided by the classic Arduino IDE.
how to open examples)
Anatomy of the Serial Monitor window
Sending and receiving data
In the Outbound Area 1&you can enter characters. As soon as
you click on the Send Button&2&, the string is sent to your
Arduino board and can be
received by the board via a Serial.Read() function.
Strings received from your board are displayed in the Inbound Area&3&.
Settings and other functions
The other elements of the Serial Monitor window are important to configure
and control the serial connection.
1&Connection
By activating/deactivating this box, you
can establish or interrupt the connection to your board. When the
connection is interrupted, then the serial port is free for other programs on
activate this box again, the connection will be restored. The behavior of your
Arduino board
depends on
the DTR checkbox (see below).
The DTR line of your board's UART is used to reset the board and restart the sketch. If
this box is activated (highlighted), Visual Micro controls the DTR line which
results in a board reset if the board connection is established/restored (with
the "Connect" box above). The DTR switch has no effect if you use
SoftwareSerial as the transport method, see "".
The DTR switch also has no effect with some boards that have a
separate small processor for serial communications.
If this box is checked, Visual Micro&
can start/stop incoming data to avoid buffer overruns with high data
rates/slow PCs, by controlling the COM port's Rts line.
4&"Auto-Scroll" button
activated, the inbound window scrolls as data arrives.& You can
also click into the inbound window to temporarily disable pause the
display and disable scrolling. Move the cursor to the end of the
window to restart display.
5&"Auto-Recon" button
activated, Visual Micro attempts to reconnect automatically when hardware is plugged in and/or becomes available.
Shows the connection state of the board in real-time by showing the
"Connect" button's text in green or red: &/&.
Some types of ports do not support this feature.
Only available in the Pro Version of Visual Micro.
6&"Auto-Clear"
When this box is activated, the inbound area of the window will be cleared
every time the port is reopened.
This setting can be used to route all incoming data from one board
to another board connected to a different COM port.
Example: If you have two boards attached to your PC, one on COM3 and one
on COM4, and you choose "COM4" in the Serial Monitor of COM3, then all
data coming in from COM3 will be displayed in the Serial Monitor and
sent to the other board via COM4.
end settings
Specifies how the string is terminated that you send to your Arduino board
after clicking the Send Button.
"no line endings": no character is appended to the
string being sent.
"Carriage return": a Carriage Return character
('CR'=0x0d or '\r') is appended.
"Line Feed": a Line Feed character
('LF'=0x0a or '\n') is appended.
"Both CR & LF": both a CR and a LF character are
The right setting depends on how your sketch handles the incoming
characters. In the Arduino ReadASCIIString example, you will notice
that the sketch waits for a '\n', which is a "newline" or "Line
Feed". So for this sketch, the "Line Feed" setting will be the right
one. If in doubt, use the "Both NL and CR" setting.
Line end characters are a convenient and common way of indicating
your board the end of a transmission.
9&Baud Rate Settings
Specifies the transmission speed or so called "baud rate" that
Micro and your board use. This setting must match the setting your
sketch uses in the Serial.begin()
If the baud rates of your board and Visual Micro don't match, you
will see no incoming characters or garbage.
If you are using Visual Micro debugging, then this value must
also match the baud rate setting you chose for debugging communication,
The Options Menu Button&10&
for a description
of this button's& menu items.
The "CStr" Button&11&
The CStr switch is only available
to users of the Visual Micro Pro version.
This is an On/off toggle switch.
If switched on, then the Serial Monitor outbound text box supports escape
sequences, similar to those used in C++ and C#,& and shows them as
2-character sequences, starting with a '\':
The supported escape sequences are:
NUL character (value 0)
"Bell" character (value 07)
Backspace character (value 08)
Tab character& (value 09)
Newline character (value
10 dec, 0x0a hex)
"Vertical tab" character (value 11 dec, 0x0b hex)
"Form feed" character (value 12 dec, 0x0c hex)
Carriage return character (value 13 dec, 0x0d hex)
Backslash character '\'
A single, one byte character with the hexadecimal value of 0xnn
It is recommended to use the \x00nn variant of this
notation, to avoid that characters following the sequence are
traeted as being part of the hex code, like in "\x4fa", which would
not result in '\x4f', followed by an 'a', but as an illegal
character of value 0x4fa,& which will be converted to a '?' by
Visual Micro.
\U000000nn
Identical to \xnn
The \x..., \u... and \U... only support the ASCII
character value range from 0x0 through 0x7f.
If you are working with such special characters,
and you send them to devices like an LCD display: Please keep in mind
that it depends on the device, if and how these characters are interpreted.
E.g. typical 2- or 4-line LCD displays do not understand \n as a new
line character. In this example, it is up to your sketch to send the
right commands to the LDC controller, in order to advance to the next
This is also true for Non-ASCII-characters above 0x80, where devices may
have their very own character sets.
The Log Button&12&
The Serial Window writes sent and received data to a log file.
When you click on the button itself, you can switch logging on:
if you click on the submenu arrow on the button's right side, the Log
submenu appears, where you can specify in which folder log files shall be written (2), and you can
open this folder for opening and reviewing log files (1).
The Most Common Mistakes
When Using Serial Connections
These are the most common causes for problems with serial communication:
Wrong baud rate selected
Make sure that the baud rate in your sketch is the same as selected in the
Serial Monitor of Visual Micro. If both do not match, you won't be able
to read and write characters to and from the serial connection.
Serial.begin() missing
You cannot perform any serial reading or writing operation unless you call
Serial.begin() in your sketch. Usually, Serial.begin() is put into the setup() function of your
Wrong port on the Arduino board chosen
With boards that have multiple serial ports, like the Arduino Due, you must
make sure that you work with the correct port in your sketch and that you have
connected this port to your PC.
Wrong serial port selected on PC
If you connect your board to different USB connectors of your PC or if you
use a different board, the COM port number may change. In these cases you must
adjust the COM port setting in the Visual Micro
Arduino Communications toolbar.
What is a COM port?
The CPUs used in most boards have one or more built in serial
communication devices called
. They work according to the RS-232 standard. The USB hardware on
the board converts these signals into similar USB signals. On the PC side, the
opposite takes place: a driver receives the USB signals, and mimics a
RS-232 hardware interface in your PC, that's why these drivers are called "Virtual
Com Port Drivers", because they are no read serial ports, but they
simulate them.
From a PC application's perspective, everything looks as if the UART of
your board's CPU was directly connected to a RS-232 connector in your PC.
Traditionally,
serial ports in PCs are called COM ports and numbered COM1, COM2 etc.
As a consequence, you can use any software that is able to
communicate via
COM ports&for communication with your board, not just Visual Micro or
the Arduino IDE.
Other supported Ide's:-
Other Pages

我要回帖

 

随机推荐