 |
|
คัยรู้เรื่อง rfid ช่วยดูหน่อยคับ (vb.net) คือผมลองทำตามลิ้งนี้ อ่ะคับ แล้วมันอ่านแล้วก้อเขียนไม่ได้คับ โค้ดผิดตรงไหนหรือป่าวช่วยดูทีคับ |
|
 |
|
|
 |
 |
|
คือผมลองทำตามลิ้งนี้ http://www.rfidbasic.com/main.php?topic_id=31
อ่ะคับ แล้วมันอ่านแล้วก้อเขียนไม่ได้คับ โค้ดผิดตรงไหนหรือป่าวช่วยดูทีคับ
อันนี้ส่วนอ่านข้อมูลคับ
Code (VB.NET)
Imports VB = Microsoft.VisualBasic
Imports System.Data.SqlClient
Public Class frm_ReadTag
Dim j As Short
Dim port, baud As Integer
Dim buf(200) As Byte
Dim b1 As Byte
Dim s1 As String
Dim counttags As Short
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub frm_ReadTag_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim flag As Object
Dim lb_info As Object
Dim port, i, baud As Integer
Dim j As Short
Dim buf1(200) As Byte
port = 2 'กำหนด port
If (port = 0) Then
lb_info.Caption = "Please select COM Port!"
End If
baud = CInt(9600) ' กำหนด Rate
If (baud = 0) Then
lb_info.Caption = "Please select Baud rate!"
End If
'Open Port
i = rf_init_com(port, baud)
If (i <> 0) Then
MsgBox("Open Port Fail!")
Exit Sub
Else
flag = True
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' ตั้งเวลา อ่าน Tag
Dim s As Short
Dim sdata(200) As Byte
Dim sLen As Byte
Dim b3, b2 As Byte
'b3 = CByte(3)
b2 = CByte(3)
TextBox1.Text = ""
If ISO15693_Read(0, 0, buf(1), b3, b2, sdata(0), sLen) <> 0 Then
MsgBox("Red data faile", MsgBoxStyle.Critical, "")
Exit Sub
Else
For s = 0 To sLen - 1
TextBox1.Text = TextBox1.Text & VB.Right("0" & Hex(sdata(s)), 2)
Next
TextBox1.Text = TextBox1.Text.Substring(0, 8)
End If
End Sub
End Class
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-07-17 01:10:49 |
By :
moshi555 |
View :
3393 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองตรวจสอบเครื่องอ่านผ่าน hyperterminal หรือ debug tool(มีรึป่าวไม่แน่ใจ) ที่มากับ strong
link ยังครับ ถ้าอ่านได้ค่อยไปเช็คโค้ดต่อครับ
|
 |
 |
 |
 |
Date :
2009-07-17 14:57:38 |
By :
zZzZzZ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตัว demo ที่ติดมากับโปรแกรมหรือป่าวคับ debug tool ที่ว่า -*-
|
 |
 |
 |
 |
Date :
2009-07-17 19:31:02 |
By :
moshi555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ISO ผิดครับ
มันไม่ใช่ ISO15693 มันเป็นอีก ISO ครับ
|
 |
 |
 |
 |
Date :
2012-08-20 19:44:07 |
By :
palamorter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รองขอ SDK จากบริษัทที่จำหน่ายดูครับ เค้าน่าจะมีให้ครับ
|
 |
 |
 |
 |
Date :
2012-08-21 08:26:18 |
By :
Nameless |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมว่า .dll ของ จขกท. มันเป็น ISO_rfid iso 14443 ครับ ต้องเขียนอีกแปปครับ ในส่วน declare.vb ต้องแก้ครับ
Code (VB.NET)
Option Strict Off
Option Explicit On
Module mo_declare
Public Declare Function rf_init_com Lib "MasterRD.dll" (ByVal port As Integer, ByVal baud As Integer) As Integer
Public Declare Function rf_ClosePort Lib "MasterRD.dll" () As Integer
'******************************************MF1*****************************************
Public Declare Function rf_request Lib "MasterRD.dll" (ByVal icdev As Short, ByVal model As Byte, ByRef TagType As Short) As Integer
Public Declare Function rf_anticoll Lib "MasterRD.dll" (ByVal icdev As Short, ByVal bcnt As Byte, ByRef ppsnr As Byte, ByRef pRLength As Byte) As Integer
Public Declare Function rf_select Lib "MasterRD.dll" (ByVal icdev As Short, ByRef pSnr As Byte, ByVal srclen As Byte, ByRef size As Byte) As Integer
Public Declare Function rf_M1_authentication2 Lib "MasterRD.dll" (ByVal icdev As Short, ByVal model As Byte, ByVal block As Byte, ByRef key As Byte) As Integer
Public Declare Function rf_M1_read Lib "MasterRD.dll" (ByVal icdev As Short, ByVal block As Byte, ByRef buff As Byte, ByRef pLen As Byte) As Integer
Public Declare Function rf_M1_write Lib "MasterRD.dll" (ByVal icdev As Short, ByVal block As Byte, ByRef buff As Byte) As Integer
Public Declare Function rf_halt Lib "MasterRD.dll" (ByVal icdev As Short) As Integer
Public Declare Function rf_M1_initval Lib "MasterRD.dll" (ByVal icdev As Short, ByVal block As Byte, ByVal Value As Integer) As Integer
Public Declare Function rf_M1_readval Lib "MasterRD.dll" (ByVal icdev As Short, ByVal block As Byte, ByRef pValue As Byte) As Integer
Public Declare Function rf_M1_increment Lib "MasterRD.dll" (ByVal icdev As Short, ByVal block As Byte, ByVal Value As Integer) As Integer
Public Declare Function rf_M1_decrement Lib "MasterRD.dll" (ByVal icdev As Short, ByVal block As Byte, ByVal Value As Integer) As Integer
Public Declare Function rf_beep Lib "MasterRD.dll" (ByVal icdev As Short, ByVal Value As Integer) As Integer
Public Declare Function rf_light Lib "MasterRD.dll" (ByVal icdev As Short, ByVal color As Integer) As Integer
'////////////======== Function ISO14443B Function ================================
End Module
แบบนี้ก่อน แล้วไปแก้ code ใน from อีกทีครับ
|
 |
 |
 |
 |
Date :
2012-08-21 13:19:00 |
By :
palamorter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|