Private Sub clear_receivetext_Click() receivetext.Text = "" End Sub Private Sub clear_sendtext_Click() sendtext.Text = "" End Sub Private Sub close_Click() MSComm1.PortOpen = False '关闭串口 End Sub Private Sub Form_Load() MSComm1.CommPort = 4 '使用串行端口1
以前调试设备使用过很多次,现在将这些功能整合,可以作为松下PLC与上位机VB通信的初级教程。有多个应用,以下为部分。 Public Function ImadacommPanasonic(Mymscomm As MSComm, ByVal id As Integer) Mymscomm.CommPort = id Mymscomm.Settings = "9600,o,8,1" Mymscomm.InBufferSize = 1024 Mymscomm.OutBufferSize = 512
'定义窗体级变量 '在显示、绘图、报警等过程中使用 Dim datatemp(1000) As Single '用于存储温度采样值 Dim num As Integer '用于存储采样值个数 '串口初始化 '在窗体的Load事件中加入下列代码对串口进行初始化: Private Sub Form_Load() MSComm1.CommPort = 1 MSComm1.InputMode = 1 MSComm1.RThreshold = 1 MSComm1.SThreshold = 1 MSCom
Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorvalues As Long) As Long Private Sub Check1_Click() If Check1 Then csh = 100 Else csh = 200 End If End Sub Private Sub Command2_Click() On Error Re
vb串口调试助手,源码下载 Private Sub CmdSendFile_Click() '发送文件 On Error GoTo Err If MSComm1.PortOpen = True Then ' 如果串口打开了,则可以发送数据 If FileData = "" Then ' 判断发送数据是否为空 MsgBox "发送的文件为空", 16, "串口调试助手" ' 发送数据为空则提示 Else If ChkHexReceive.Value = 1 Then ' 如果按十六进制接收时,按
VB实现pc与单片机串口通信任务 //利用vb实现pc与单片机串口通信任务 //编写程序代码 '定义变量 Dim cnum As Integer '循环计数标志 Dim choosenum As Integer'选择指示灯号 '串口初始化 '在窗体的Load事件中加入下列代码对串口进行初始化 Private Sub Form_Load() MSComm1.CommPort=1 MSComm1.InputMode=1 MSComm1.RThreshold=1 MSComm1.SThreshold
可按时间长短显示波形!很好的资料!Private Sub MSComm1_OnComm() ' RS232 端口监视 TEMP = 0 FUK = "" ModStr = "" ModStr = MSComm1.Input If LOGIC Then If ModStr = "" Then TEMP = "0" Else FUK = Asc(ModStr) TEMP = TEMP + FUK End If LGAna.CommActiv (Hex$(TEMP)) Exit Sub End If
/* This file is part of AutoQuad ESC32. AutoQuad ESC32 is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at