Dim temp As Integer
Dim t As TextStream
Set t = fs.OpenTextFile("D:\testplay\sound\shuduFile.txt")
temp = t.ReadLine
t.Close
Set t = Nothing
On Error GoTo 0
Dim arr(1 To 20) As Byte
Dim Buff As Variant
'模拟量为0-4096
If temp = 1 Then
MSComm1.OutBufferCount = 0
'读取编码
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim arr1() As String
arr1 = Split(jishiqi, ",")
Dim i As Integer
Dim m As Integer
m = UBound(arr1)
If (m + 1 <> 19) Then
MsgBox "编码长度应该为19,请检查!"
Timer3.Enabled = False
Exit Sub
End If
For i = 0 To m
arr(i + 1) = Val("&H" & arr1(i))
Next
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'CRC
For i = 1 To 19
n = n + CInt(arr(i))
Next
arr(20) = n Mod 256
Buff = arr
MSComm1.Output = Buff
'1A 72 73 00 0F A0 30 00 33 03 88 66 66 66 66 66 66 00 08 08
Else
MSComm1.OutBufferCount = 0
End If
IT618资讯网 提供服务端开发,前端开发,网页特效,热门开源系统研究,软件下载,站长建站,淘宝开店等学习资料.