……
Dim ROM(8) As Integer
Dim dmmy, search, flag As Integer
Dim MyHandle As Long
Dim RomString As String
Dim state_buffer(15360) As Byte
Private Declare Function TMExtendedStartSession Lib "IBFS32.DLL" (ByVal PortNum As Integer, ByVal PortType As Integer, ByVal Reserved As Any) As Long
Private Declare Function TMSetup Lib "IBFS32.DLL" (ByVal session_handle As Long) As Integer
Private Declare Function TMFirst Lib "IBFS32.DLL" (ByVal session_handle As Long, state_buffer As Byte) As Integer
Private Declare Function TMRom Lib "IBFS32.DLL" (ByVal session_handle As Long, state_buffer As Byte, ROM As Integer) As Integer
Private Declare Function TMEndSession Lib "IBFS32.DLL" (ByVal session_handle As Long) As Integer
……
MyHandle=TMExtendedStartSession(2, 1, vbNullString) '建立会话
If (MyHandle > 0) Then'成功建立会话
dmmy=TMSetup(MyHandle)'初始化
search=TMFirst(MyHandle, state_buffer(0)) '找设备,找到设备返回“1”
If (search=1)
Then ROM(0)=0'表示读数据
flag=TMRom(MyHandle, state_buffer(0), ROM(0)) '读得值放入ROM(0 to 7)
RomString=""
For I=7 To 0 Step-
If(ROM (I)<=&HF) Then RomString=RomString+"0"
RomString=RomString + Hex$(ROM(I))
Next I '生成ID串RomString
Text1.Text=RomString
End If
dmmy=TMEndSession(MyHandle)‘结束会话
End If
……
五、 应用前景展望
作为1种新型智能化数据信息载体,iButton正越来越广泛应用于日常生活,其应用系统大体可分为如下几个方面:
① 应用于身份识别,如电子防盗门锁、单位考勤系统、智能小区人员出入管理系统、计算机软件的硬件加密、电子防伪、暂住人口管理系统等。
② 应用于预收(付)费系统,如预付费水电表、停车场收费系统、电子钱包、电子车票、高速公路收费、公共收费电话等。
③ 应用于数据采集系统,如机动车运行状态参数采集器、温度遥测系统、小型气象站等。
④ 应用于军事领域,如军事保密、情报系统的人员联络等。
结束语
Dallas公司推出的智能信息载体iButton,具有广阔的应用前景,必将给人们的生活带来深刻的影响。相信基于iButton的新型数字识别系统不久将会得到广泛的应用。MES
参考文献
1 Dallas Semiconductor Corporation. Book of DS19xx iButton Standards\[M\]. http://www.ibutton.com
2 Dallas Semiconductor Corporation. DS0621-SUL iButton-TMEX Revision 3.10 Reference Manual\[M\]. http://www.ibutton.com
3 Dallas Semiconductor Corporation.DS0621-SDK iButton TMEX Professional SOFtware Developer's Kit\[M\]. http://www.ibutton.com
4 潘日芳,凌志浩. 微型计算机原理及应用基础. 上海:华东化工学院出版社, 1993
5 何立民. 单片机应用系统设计. 北京: 北京航空航天大学出版社, 1990