863
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Public Offline As Boolean
Public SendingMsg As Boolean
Public SendAll As Boolean
Public langflag As Integer
Public FinishULData As Boolean
Public Iniflag As Boolean
Public FinishFlag As Boolean
Public PressStop As Boolean
Public Almshow As Boolean
Public SendFile As Boolean
Public AllowMoni As Boolean
Public FinishMoni As Boolean
Public SendPara As Boolean
Public Addr As Integer
Public addrStr1 As String
Public addrRecieve As String
Public ParaTabShow As Boolean
Public TestStyle As Integer
Public SparaExist As Boolean
Public reqTest As Boolean
Public DatAddr03 As String
Public coderight As Boolean
Public coderight1 As Boolean
Public ResumeFlag As Boolean
Public fftFlag As Boolean
Public message As String
Public AdjFlag As Integer
Public ServoType As String
Public TimerCount As Integer
Public g_MSCOMM As Control
Public g_Timer2 As Timer
Public MDIhwnd As Long
Public SpecialShow As Boolean
Public PhaseShow As Boolean
Public OperationShow As Boolean
Public LoadingShow As Boolean
Public JOGShow As Boolean
Public InertiaShow As Boolean
Public HandShow As Boolean
Public DMShow As Boolean
Public IMShow As Boolean
Public ScopeShow As Boolean
Public fftCmdShow As Boolean
Public fftGraphicShow As Boolean
Public testCmdShow As Boolean
Public testGraphicShow As Boolean
Public testParaShow As Boolean
Public Cn As ADODB.Connection
Public Function ProcessContinue(ByVal hwnd As Long) As Boolean
If Not FinishULData Then
If Not PressStop Then
ProcessContinue = False
MessageBoxEx hwnd, "UpLoad Plot Data", , MB_OK Or MB_ICONINFORMATION, LANG_ENGLISH
Exit Function
End If
End If
If SendPara Then
ProcessContinue = False
MessageBoxEx hwnd, "SendPara", ,MB_OK Or MB_ICONINFORMATION, LANG_ENGLISH
Exit Function
End If
If fftFlag Then
ProcessContinue = False
MessageBoxEx hwnd, "fftFlag", , MB_OK Or MB_ICONINFORMATION, LANG_ENGLISH
Exit Function
End If
ProcessContinue = True
End Function
Public Sub SendingMessage(ByVal msg As String)
Dim Out1() As Byte
Dim Lrc As Long
Dim a As Integer
Dim L As Integer
SendingMsg = True
msg = addrStr1 & msg
L = Len(msg)
Dim i As Integer
Lrc = 0
For i = 0 To L / 2 - 1
a = Val("&H" & Mid(msg, 2 * i + 1, 2))
Lrc = a + Lrc
Next
Lrc = Lrc Mod 256
Lrc = 256 - Lrc
If Lrc = 256 Then
Lrc = 0
End If
ReDim Out1(L + 4) As Byte
For i = 1 To L
Out1(i) = Asc(Mid(msg, i, 1))
Next i
If Lrc < 16 Then
Out1(L + 1) = Asc(Mid("0" & Hex(Lrc), 1, 1))
Out1(L + 2) = Asc(Mid("0" & Hex(Lrc), 2, 1))
Else
Out1(L + 1) = Asc(Mid(Hex(Lrc), 1, 1))
Out1(L + 2) = Asc(Mid(Hex(Lrc), 2, 1))
End If
Out1(0) = Asc(":")
Out1(L + 3) = &HD
Out1(L + 4) = &HA
If g_MSCOMM.PortOpen = True Then
g_MSCOMM.OutBufferCount = 0
g_MSCOMM.Output = Out1 '
End If
End Sub
Public g_MSCOMM As Variant
试一试Private Sub f(ByVal c As Control)
Debug.Print c.Parent.Name
Debug.Print c.CommPort
End Sub