用FLYMCU-ISP进行固件烧录的教程比较多,一直比较好奇,RTS和DTR这两个引脚是如何通过软件完成的。网上问这个问题的也不少,正确答案不多见。今天查了一下,做个备注吧!

问题

MCUISP是怎样判断并控制RTS和DTR输出的?

比如下面这个,OPENEDV上讨论得比较多的电路(以下图片均来自OpenEDV【1】),

回答

事实上这个问题很简单,通过Windows串口API即可实现,我直接把该函数列到下面【2】,

EscapeCommFunction function

  • 12/05/2018
  • 2 minutes to read

Directs the specified communications device to perform an extended function.

Syntax

C++Copy

BOOL EscapeCommFunction(HANDLE hFile,DWORD  dwFunc
);

Parameters

hFile

A handle to the communications device. The CreateFile function returns this handle.

dwFunc

The extended function to be performed. This parameter can be one of the following values.

TABLE 1
Value Meaning

CLRBREAK

9

Restores character transmission and places the transmission line in a nonbreak state. The CLRBREAK extended function code is identical to the ClearCommBreak function.

CLRDTR

6

Clears the DTR (data-terminal-ready) signal.

CLRRTS

4

Clears the RTS (request-to-send) signal.

SETBREAK

8

Suspends character transmission and places the transmission line in a break state until the ClearCommBreak function is called (or EscapeCommFunction is called with the CLRBREAK extended function code). The SETBREAK extended function code is identical to the SetCommBreak function. Note that this extended function does not flush data that has not been transmitted.

SETDTR

5

Sends the DTR (data-terminal-ready) signal.

SETRTS

3

Sends the RTS (request-to-send) signal.

SETXOFF

1

Causes transmission to act as if an XOFF character has been received.

SETXON

2

Causes transmission to act as if an XON character has been received.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Requirements

TABLE 2
   
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

参考:

【1】http://www.openedv.com/posts/list/50030.htm

【2】https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-escapecommfunction

MCU_通过windows串口API控制RTS和DTR相关推荐

  1. C#之windows桌面软件第四课:串口助手控制设备的开关

    串口助手控制设备的开关 using System; using System.Collections.Generic; using System.ComponentModel; using Syste ...

  2. windows串口通信函数API

    windows串口通讯主要函数 先列个目录表 1.CreateFile - 打开串口: 2.SetupComm-初始化一个指定的通信设备的通信参数 3.ReadFile - 读数据: 4.WriteF ...

  3. ESP32串口API

    翻自:https://docs.espressif.com/projects/esp-idf/zh_CN/latest/api-reference/peripherals/uart.html UART ...

  4. Win32串口API

    Win32串口API 在工业控制中,工控机(一般都基于Windows平台)经常需要与智能仪表通过串口进行通信.串口通信方便易行,应用广泛.  一般情况下,工控机和各智能仪表通过RS485总线进行通信. ...

  5. C/C++使用Windows的API实现共享内存以及同步

    目录 共享内存 事件-Event 实现思路 创建方(服务端) 连接方: 进程同步: windows的API CreateFileMapping MapViewOfFile CreateEvent Wa ...

  6. 通过串口来控制网管型交换机的操作步骤详解

    之前我们对网管型交换机的三种管理方式简单的给大家介绍了一下,一.通过串口管理:二.通过web管理:三.通过网管软件管理.今天,飞畅科技的小编来为大家详细介绍下通过串口终端配置是如何对网管交换机进行控制 ...

  7. windows常用 API函数

    系统API查询 http://www.vbgood.com/api.html http://hi.baidu.com/3582077/item/9cc3483b581f53c5392ffae3 第一个 ...

  8. 探讨如何在Linux上通过windows的域控制上网( by quqi99 )

    探讨如何在Linux上通过windows的域控制上网( by quqi99 ) 作者:张华  发表于:2012-05-08 版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及 ...

  9. 89个windows常用API调用

    VC API常用函数简单例子大全 第一个:FindWindow根据窗口类名或窗口标题名来获得窗口的句柄,该函数返回窗口的句柄 函数的定义:HWND WINAPI FindWindow(LPCSTR l ...

  10. C语言基础入门48篇_18_使用循环移动游戏人物(屏幕符号运动、while(1){}进行实时响应,if(表达式){},switch(表达式){},windows的API及API进行自行封装使)

    本篇介绍使用循环语句实现指定符号的坐标移动,使用到了while(1){}进行实时响应,if(表达式){},switch(表达式){},windows中封装的API并对API进行自行封装使用. 1.实现 ...

最新文章

  1. 土壤微生态文献包免费领取 | 150篇近两年高影响因子土壤微生态相关文章
  2. 关于Java HotSpot(TM) 64-Bit Server VM warning: Insufficient space for shared memory file: 11043的解决办...
  3. SqlCommand类,在与数据库交互式一定要用到的属性
  4. 盐城工学院计算机考研高吗,信息学院计算机班计玮考取中南大学研究生
  5. Effective Java (7) - 避免终止方法
  6. java 字符串 字节数组_字符串到字节数组,字节数组到Java中的字符串
  7. React环境配置(第一个React项目)
  8. freeswitch 使用mysql替换默认的sqlite
  9. 色差大调色难?实操讲解如何去除谷歌影像色差
  10. 使用smartdns加速DNS域名解析
  11. B2B网关支付方案介绍
  12. 记一次利用tomcat manager部署war包失败并解决的经历
  13. 使用Jhon工具破解Windows密码
  14. mac macbook应用清单
  15. 最近一直在准备PMP证书考试,停更!
  16. 2020年全国大学生数学建模竞赛B题穿越沙漠问题——建立整数线性规划模型(ILP)——通过LINGO求解
  17. 鸿蒙2000plus,华为P50pro曝光,天玑2000plus+5400mAh+鸿蒙系统,售价感人
  18. ASP.Net ScriptManager 与 UpdatePanel
  19. 智慧城市在七个方面的应用
  20. oracle 调整shared pool,Oracle性能调整中的Shared pool tunning要点

热门文章

  1. 优控触摸屏使用手册_中达优控plc触摸屏一体机说明书资料
  2. AppCompat (AppCompatActivity) Jetpack
  3. 仿Hex-Editor,实现简单地二进制文件查看器JHexer
  4. VMware14虚拟机安装Ubuntu
  5. ISO 22000:2018食品安全管理体系介绍、认证及其标准
  6. 免费使用正版 IDEA
  7. IDEA代码格式化后缩进符不正确
  8. win7卡在正在启动windows界面_电脑在“windows正在启动” 画面停留的时间长如何办...
  9. 基于SSM框架和easyUI框架的简易人事管理系统(六)
  10. VPX加固机箱学习资料第289篇:基于3U VPX的 5槽加固机箱