Microcontroller › PIC › Pic16f877a interface with ADST11SD300&310 Fingerprint Identification Module › there is a sample visual
November 8, 2013 at 5:14 am
#10585
Participant
there is a sample visual basic 6 code and its working, but i want to make it stand alone by using MCU pic16f877a..i tried to analyze the program and i coded into mikro c but not working….
here is the code in vb6.
‘
Option Explicit
Dim SData(24) As Byte
Dim SReply(48) As Byte
Dim Replied As Boolean
Dim Rx As String
Dim CKS As Integer
‘
Private Sub cmdReg_Click()
Dim i As Integer
Dim dummy As String
Dim V1, V2 As Integer
Dim Good As Boolean
Good = True
V1 = Int(Val(txtUserNo.Text) / 256)
V2 = Val(txtUserNo.Text) – V1 * 256
For i = 1 To 22
SData(i) = 0
Next i
SData(0) = &H55
SData(1) = &HAA
SData(2) = &H3
SData(3) = &H1
SData(4) = &H2
SData(5) = &H0
SData(6) = V2
SData(7) = V1
Call Checksum
dummy = MSComm1.Input
For i = 0 To 23
MSComm1.Output = Chr(SData(i))
Next i
back:
Replied = False
While Replied = False
DoEvents
Wend
If SReply(6) = 0 Then
If Asc(Mid$(Right$(Rx, 24), 9, 1)) = &HF1 And Asc(Mid$(Right$(Rx, 24), 10, 1)) = &HFF Then
txtResults.Text = “Press a finger to register first time.”
End If
If Asc(Mid$(Right$(Rx, 24), 9, 1)) = &HF2 And Asc(Mid$(Right$(Rx, 24), 10, 1)) = &HFF Then
txtResults.Text = “Press the same finger the second time…”
End If
If Asc(Mid$(Right$(Rx, 24), 9, 1)) = &HF3 And Asc(Mid$(Right$(Rx, 24), 10, 1)) = &HFF Then
txtResults.Text = “Press the same finger the last time…”
End If
If Asc(Mid$(Right$(Rx, 24), 9, 1)) = &HF4 And Asc(Mid$(Right$(Rx, 24), 10, 1)) = &HFF Then
txtResults.Text = “Lift finger…”
End If
If Asc(Mid$(Right$(Rx, 24), 5, 1)) = &H6 Then
txtResults.Text = “Ok”
Exit Sub
End If
GoTo back
Else
Print_Error
If SReply(
= &H21 Then GoTo back

End If
End Sub
‘
Public Sub Checksum()
Dim i As Integer
CKS = 0
For i = 0 To 21
CKS = CKS + SData(i)
‘ MsgBox (CKS)
Next i
SData(22) = CKS And &HFF
SData(23) = (CKS – (CKS And &HFF)) / 256
MsgBox (SData(23))
End Sub