如何在串口通信中使用VB编程实现单机的自发自收?

来源:百度知道 编辑:UC知道 时间:2024/06/22 23:48:50
我已经将串口的2脚RXD和3脚TXD短路连在一块,要在自己的屏幕上看到收发字符,纯编程实现,不能借助其他工具,谢谢啦!
大哥,你的答案我试过了,实现不了啊,我是想用一个串口做到自发自收,能不能再帮忙给看下?谢谢啦

将以下代码另存为form1.frm
然后导入你的程序
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text2
Height = 420
Left = 1170
TabIndex = 2
Text = "Text2"
Top = 945
Width = 960
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 420
Left = 2565
TabIndex = 1
Top = 1