发表于:2006/3/11 16:30:00
#0楼
请教一下,下面的代源是什么意思
Private Sub Combo2_Change()
Select Case Combo2.Text
Case "50 KB"
m_Timing0 = Val("&H09")
m_Timing1 = Val("&H1C")
Case "100KB"
m_Timing0 = Val("&H04")
m_Timing1 = Val("&H1C")
Case "125KB"
m_Timing0 = Val("&H03")
m_Timing1 = Val("&H1C")
Case "250KB"
m_Timing0 = Val("&H01")
m_Timing1 = Val("&H1C")
Case "500KB"
m_Timing0 = Val("&H00")
m_Timing1 = Val("&H1C")
Case "800KB"
m_Timing0 = Val("&H00")
m_Timing1 = Val("&H16")
Case "1 MB"
m_Timing0 = Val("&H00")
m_Timing1 = Val("&H14")
End Select
主要是M_TIMING有什么作用?
Dim tmptime As Boolean
Dim str As String
Dim strdata As String
Dim i As Integer
Dim j As Integer
Dim ID As Long
Dim d As Integer
Dim n As Integer
Sub Send(ID As Long, str As String) '向电机发送命令
Dim data(7) As Byte
Dim frameinfo As VCI_CAN_OBJ
Dim tmpstr As String
Dim tmpID As Long
tmpID = Val(ID)
strdata = " "
i = 0
For i = 0 To 7
strdata = Left(str, 2)
If Len(strdata) = 0 Then
Exit For
End If
str = Right(str, Len(str) - 2)
data(i) = Val("&H" + strdata)
Next
frameinfo.DataLen = i
frameinfo.ExternFlag = 0
frameinfo.RemoteFlag = 0
frameinfo.SendType = 2
frameinfo.ID = tmpID
For j = 0 To i - 1
frameinfo.data(j) = data(j)
Next
If VCI_Transmit(4, 0, 0, frameinfo, 1) <> 1 Then
MsgBox ("发送数据失败")
End If
End Sub
用的是不是串口通讯指令啊?
Private Sub Combo2_Change()
Select Case Combo2.Text
Case "50 KB"
m_Timing0 = Val("&H09")
m_Timing1 = Val("&H1C")
Case "100KB"
m_Timing0 = Val("&H04")
m_Timing1 = Val("&H1C")
Case "125KB"
m_Timing0 = Val("&H03")
m_Timing1 = Val("&H1C")
Case "250KB"
m_Timing0 = Val("&H01")
m_Timing1 = Val("&H1C")
Case "500KB"
m_Timing0 = Val("&H00")
m_Timing1 = Val("&H1C")
Case "800KB"
m_Timing0 = Val("&H00")
m_Timing1 = Val("&H16")
Case "1 MB"
m_Timing0 = Val("&H00")
m_Timing1 = Val("&H14")
End Select
主要是M_TIMING有什么作用?
Dim tmptime As Boolean
Dim str As String
Dim strdata As String
Dim i As Integer
Dim j As Integer
Dim ID As Long
Dim d As Integer
Dim n As Integer
Sub Send(ID As Long, str As String) '向电机发送命令
Dim data(7) As Byte
Dim frameinfo As VCI_CAN_OBJ
Dim tmpstr As String
Dim tmpID As Long
tmpID = Val(ID)
strdata = " "
i = 0
For i = 0 To 7
strdata = Left(str, 2)
If Len(strdata) = 0 Then
Exit For
End If
str = Right(str, Len(str) - 2)
data(i) = Val("&H" + strdata)
Next
frameinfo.DataLen = i
frameinfo.ExternFlag = 0
frameinfo.RemoteFlag = 0
frameinfo.SendType = 2
frameinfo.ID = tmpID
For j = 0 To i - 1
frameinfo.data(j) = data(j)
Next
If VCI_Transmit(4, 0, 0, frameinfo, 1) <> 1 Then
MsgBox ("发送数据失败")
End If
End Sub
用的是不是串口通讯指令啊?