📄 newfun.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4050
ClientLeft = 60
ClientTop = 345
ClientWidth = 5700
LinkTopic = "Form1"
ScaleHeight = 4050
ScaleWidth = 5700
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame1
Height = 3135
Left = 240
TabIndex = 0
Top = 720
Width = 5295
Begin VB.CommandButton Command2
Caption = "asc_hex"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 4
Top = 1680
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "wr_eeprom"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 3
Top = 720
Width = 1215
End
Begin VB.ListBox List1
Height = 2400
ItemData = "WR_eeprom.frx":0000
Left = 240
List = "WR_eeprom.frx":0002
TabIndex = 2
Top = 480
Width = 3135
End
End
Begin VB.Label Label1
Caption = "New Function Examples"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
Left = 840
TabIndex = 1
Top = 240
Width = 3615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim baud As Long
Dim offset, le As Integer
Dim data1, data2 As String * 128
Dim data3(128) As Byte
Dim hex(128) As Byte
Dim myle As Long
Private Sub Command1_Click()
offset = 10 'offset: 0--383
le = 9 'le : 1--384
data1 = "MWRD_1999"
st = swr_eeprom(icdev, offset, le, data1)
If st <> 0 Then
List1.AddItem ("swr_eeprom error")
Else
List1.AddItem ("swr_eeprom OK")
End If
st = srd_eeprom(icdev, offset, le, data2)
If st <> 0 Then
List1.AddItem ("srd_eeprom error")
Else
List1.AddItem ("srd_eeprom OK")
End If
End Sub
Private Sub Command2_Click()
'当数据的ASCII值大于128时,如下两个工具函数需声明ByRef传址方式(VB5不能转换)
data1 = "30313233343536373839a1b2c3d4e5f6"
myle = 16
st = asc_hex(data1, hex(0), myle)
If st <> 0 Then
List1.AddItem ("asc_hex error")
End If
st = hex_asc(hex(0), data2, myle)
If st <> 0 Then
List1.AddItem ("hex_asc error")
End If
If Left(data1, myle) <> Left(data2, myle) Then
List1.AddItem "Comp Error"
End If
'当写卡函数定义为byref传址方式时,利用asc_asc()函数可方便赋值
myle = 32
data1 = "00112233445566778899aabbccddeeff"
st = asc_asc(data1, data3(0), myle)
If st <> 0 Then
List1.AddItem ("hex_asc error")
End If
offset = 16
st = swr_24c02(icdev, offset, myle, data3(0))
List1.AddItem "Test Over"
End Sub
Private Sub Form_Load()
baud = 9600 'baud可在其范围内任意设置
icdev = auto_init(1, baud)
If icdev < 0 Then
List1.AddItem ("Init error!")
Exit Sub
Else
List1.AddItem ("Init OK")
End If
st = get_status(icdev, status)
If st = 0 Then
List1.AddItem ("status OK")
Else
List1.AddItem ("status error")
Exit Sub
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
st% = ic_exit(icdev&)
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -