当前位置:网站首页>keil MDK 中使用虚拟串口调试串口
keil MDK 中使用虚拟串口调试串口
2022-06-22 13:42:00 【位文杰TOP】
看了很多的文章,写的都很简单(其实也很简单:))。给出个详细一点的教程。
1. 利用VSPD将PC上的两个虚拟串口连接起来。如图我将COM2 和COM3连接起来。点击Addr pair。

2. 可以看到Virtual ports上将两个虚拟串口连接到了一起了。
3.虚拟串口准备就绪了。先将直接输入命令的方式来调试。我们打开KEIL MDK的,设置成仿真的模式。点DEBUG.在COMMAND串口输入:MODE COM2 38400, 0, 8, 1

说明:
MODE命令的作用是设置被绑定计算机串口的参数。基本使用方式为:
MODE COMx baudrate, parity, databits, stopbits
其中:
COMx(x = 1,2,…)代表计算机的串口号;
baudrate代表串口的波特率;parity代表校验方式;
databits代表数据位长度;
stopbits代表停止位长度。
例如:MODE COM1 9600, n, 8, 1
设置串口1。波特率为9 600,无校验位,8位数据,1位停止位。
MODE COM2 19200, 1, 8, 1
设置串口2。波特率为19 200,奇校验,8位数据,1位停止位。
4、点回车后,再输入 ASSIGN COM2 <S1IN> S1OUT

说明:
COMx代表计算机的串口,可以是COM1、COM2、COM3或其他;
inreg和outreg代表单片机的串口。对于只有一个串口的普通单片机,即SIN和SOUT;对于有两个或者多个串口的单片机,即SnIN和SnOUT(n=0,1,…即单片机的串口号)。
例如:ASSIGN COM1 < SIN > SOUT
将计算机的串口1绑定到单片机的串口(针对只有一个串口的单片机)。
ASSIGN COM2 < SIN > SOUT
将计算机的串口2绑定到单片机的串口0(针对有多个串口的单片机,注意串口号的位置)。
需要注意的是,参数的括号是不能省略的,而outreg则是没有括号的。
5、然后调试程序。可以看到串口COM3打印出了串口1的数据了。

边栏推荐
- PHP内置协议(支持的协议和封装协议)
- 轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
- 一文彻底弄懂工厂模式(Factory)
- C generic_ Generic class
- Network address translation nat
- Fight, programmer -- Chapter 42 will draw a bow like a full moon, look northwest and shoot Sirius
- Go all out to implement the flood control and disaster relief measures in detail and in place, and resolutely protect the safety of people's lives and property
- [introduction to postgraduate entrance examination] analysis of postgraduate entrance examination data of Cyberspace Security Major of Beijing Jiaotong University from 2018 to 2022
- C # WinForm photo album function, picture zooming, dragging, preview Pagination
- PHP built-in protocols (supported and encapsulated protocols)
猜你喜欢

Thoroughly understand the factory mode

数据库连接池:压力测试

看完这篇 教你玩转渗透测试靶机Vulnhub——DriftingBlues-5

难怪考研热度这么高,这些是研究生才有的“隐藏福利”!
![[untitled]](/img/ff/f23e5275683d4d7b13fcb94cc77702.png)
[untitled]

Lisez ceci pour vous apprendre à jouer avec la cible de test de pénétration vulnhub - driftingblues - 5

Phpstudy 2016 build Pikachu range

Data collection: skillfully using Bloom filter to extract data summary
![[Software Engineering] acquire requirements](/img/52/01320eee5e519910a62f48d604b180.png)
[Software Engineering] acquire requirements

大会倒计时 | 亚马逊云科技创新大会邀您一起构建AI新引擎 !
随机推荐
Go all out to implement the flood control and disaster relief measures in detail and in place, and resolutely protect the safety of people's lives and property
Fight, programmer -- Chapter 42 will draw a bow like a full moon, look northwest and shoot Sirius
Perceptron of machine learning
谷歌竞价账户可以探测到全球市场吗?
PHP built-in protocols (supported and encapsulated protocols)
Groovy之闭包
Struggle, programmer -- Chapter 48 A thousand gold coins are bought like Fu. Who can complain about this situation
口令安全是什么意思?等保2.0政策中口令安全标准条款有哪些?
d的破坏与安全
数据资产管理:数据发现,发现什么,怎么发现?
RealNetworks vs. Microsoft: the battle in the early streaming media industry
At 19:00 this Thursday evening, the 7th live broadcast of battle code Pioneer - how third-party application developers contribute to open source
Fluentd is easy to get started. Combined with the rainbow plug-in market, log collection is faster
嵌入式中的强符号和弱符号是什么?
那些令人懵逼的用户态&内核态
【直播回顾】战码先锋第六期:共建测试子系统,赋能开发者提
C#泛型方法
No wonder the postgraduate entrance examination is so hot. These are the "hidden benefits" of Postgraduates!
网站存在的价值是什么?为什么要搭建独立站
一文彻底弄懂单例模式(Singleton)