PDA

Click to See Complete Forum and Search --> : problem with rfid reader


varunkrish
Mar 26th, 2006, 09:08 AM
Hello Friends

i am doing a project in RFID

I have purchased an RFID Reader.

They gave me some source code with it.

It has Connect and Read Tag buttons.

I click connect ,Serial connection is started.

i click read tag, the port is opened and the writer turns into active read mode and scans any tag i place nearby.

Now my problem.

After one tag is read ,i have to click the Read Tag again ( 4 times ) really funny to make it come to the active read mode.

I am a student and want to display an automated library .

SO how can i make the reader come back into read mode after reading a tag,

say after 5 seconds.


Private Sub Command1_Click() ' Connect RFID read write unit
Call Connect
End Sub

Private Sub Connect()
Dim Mystring As String
Dim readdata As String
Dim dummy As Integer

'Check if port is open or closed
If (MSComm1.PortOpen = True) Then
MSComm1.PortOpen = False
Command1.Caption = "Connect" ' Change button caption
Else
' Initialize MSCOMM
MSComm1.CommPort = CStr(Right(Combo1.Text, 1))
MSComm1.Settings = "19200,n,8,1"
MSComm1.DTREnable = False
MSComm1.EOFEnable = False
MSComm1.Handshaking = comNone
MSComm1.InBufferSize = 512
MSComm1.InputLen = 24
MSComm1.InputMode = comInputModeText
MSComm1.NullDiscard = False
MSComm1.OutBufferSize = 512
MSComm1.ParityReplace = "?"
MSComm1.RThreshold = 0
MSComm1.RTSEnable = False
MSComm1.SThreshold = 8
MSComm1.PortOpen = True
Mystring = CStr(MSComm1.Input) ' Flush input
Command1.Caption = "Disconnect"
End If

again1:
Do While Checkport() = True ' IF RFID reader is still connected
Do
dummy = DoEvents()
Loop Until MSComm1.InBufferCount >= 8 ' Then loop until a new value is received
Mystring = CStr(MSComm1.Input) ' Store value received in 'MyString'
txtFields(0) = Mystring ' Show ID
txtFields(1) = (Date) ' Show current Date
txtFields(2) = (Time) ' Show current Time
readdata = Mystring & " @ " & Date & "=" & Time
List1.AddItem readdata
Loop
End Sub

Static Function Checkport() As Boolean
If (MSComm1.PortOpen = True) Then
Checkport = True
Else
Checkport = False
End If
End Function

varunkrish
Mar 26th, 2006, 09:22 AM
added project files also for ur reference

me a student and stuck with this in final stage of my degree..

please help

ganeshmoorthy
Apr 5th, 2006, 05:26 AM
have you tried after waiting for some time and read it in single attempt?

ganeshmoorthy
Apr 5th, 2006, 05:27 AM
since, we don not have rfid readers here, we can not check it...you can do the step by step debugging by pressing F8 key and see what happens for the 4 attempts and analyse...

varunkrish
Apr 5th, 2006, 06:56 AM
ya .. i tried stepping through te code by pressin f8.. no luck...

namrekka
Apr 5th, 2006, 07:01 AM
Don't open and close the port on every "Command1_Click".
Create a separate button for it or open the port in a form load event and close the port in a form close event.