搜索
bottom↓
回复: 9

vb可以控制串口发出一个连续的4s长度的低电平信号吗?

[复制链接]

出0入0汤圆

发表于 2009-12-11 13:22:29 | 显示全部楼层 |阅读模式
如题   想利用串口发送一个持续的低电平,用来唤醒睡眠中的单片机

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2009-12-11 13:24:13 | 显示全部楼层
空闲状态的TxD是逻辑1,串口使用负逻辑,所以空闲状态的串口是低电平。

这样能满足LZ要求吗?

出0入0汤圆

 楼主| 发表于 2009-12-11 13:27:49 | 显示全部楼层
谢谢.楼上啊。.
我没有说明白.

就是让TxD发送逻辑0,经过max232转换之后 输出一个 TTL 的低电平.

出0入22汤圆

发表于 2009-12-11 13:48:25 | 显示全部楼层
用CTS(RTS)把

出0入0汤圆

 楼主| 发表于 2009-12-11 13:56:49 | 显示全部楼层
thank you ..
楼上说说看, 具体怎么实现啊?  查了半天没查到.

出0入0汤圆

发表于 2009-12-11 14:44:07 | 显示全部楼层
在Windows环境下,帖一个API:

The EscapeCommFunction function directs a specified communications device to perform an extended function.

BOOL EscapeCommFunction(

    HANDLE hFile,        // handle to communications device
    DWORD dwFunc         // extended function to perform
   );       


Parameters

hFile

Identifies the communications device. The CreateFile function returns this handle.

dwFunc

Specifies the code of the extended function to perform. This parameter can be one of the following values:

Value        Meaning
CLRDTR        Clears the DTR (data-terminal-ready) signal.
CLRRTS        Clears the RTS (request-to-send) signal.
SETDTR        Sends the DTR (data-terminal-ready) signal.
SETRTS        Sends the RTS (request-to-send) signal.
SETXOFF        Causes transmission to act as if an XOFF character has been received.
SETXON        Causes transmission to act as if an XON character has been received.
SETBREAK        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.
CLRBREAK        Restores character transmission and places the transmission line in a nonbreak state. The CLRBREAK extended function code is identical to the ClearCommBreak function.


Return Values

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.

See Also

ClearCommBreak, CreateFile, SetCommBreak

出0入0汤圆

发表于 2009-12-11 16:51:56 | 显示全部楼层
vb有一个API字典工具,找 EscapeCommFunction 这个函数,加入它的引用,就可以用了。
头像被屏蔽

出0入0汤圆

发表于 2009-12-11 23:10:52 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽

出0入0汤圆

发表于 2009-12-11 23:15:03 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽

出0入0汤圆

 楼主| 发表于 2009-12-13 12:58:30 | 显示全部楼层
顶一个, 谢谢楼上各位。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-20 15:32

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表