ايران ويج

نسخه‌ی کامل: پروژه RFID با ماژول EM-18
شما در حال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب بندی مناسب.
صفحه‌ها: 1 2 3 4
کسی نیست کمک کنه
لطفا یک نگاه به این بندازید ببینید مشکل کجاست
$regfile = "m8def.dat"
$crystal = 8000000
$baud = 9600
'-------------------------------------------------------------------------------
Config Lcdpin = Pin , Rs = Portc.5 , E = Portc.4 , Db4 = Portb.4 , Db5 = Portb.3 , Db6 = Portb.2 , Db7 = Portb.1
Config Lcd = 16 * 2
'-------------------------------------------------------------------------------

Dim E As Byte , P As Byte
Dim C(12)as String * 1
Dim Code As String * 10

Dim A As String * 10
Dim K As String * 10
Dim B As String * 10
'Dim C As String * 11
Dim D As String * 10
Dim N As Word
Dim H As Byte
'******************************                                          '
Cls
Cursor Off
'******************************
Door_open Alias Portd.2
'Config Portd.2 = Output
Config Pinc.2 = Input
Config Pinc.3 = Input

'******************************

Do
   Cls : Lcd "<>" : Wait 1


   Step1:
      Incr E
      C(e) = Waitkey()
      If E < 12 Then Goto Step1



   For E = 3 To 12
      Incr P
      Mid(code , P , 1) = C(e)
   Next


   E = 0 : P = 0
   'Cls : Lcd Code : Wait 4
Goto F
Return
Loop
'******************************************


F:
'Code = " "

Do
  For N = 0 To 512 Step 65
Cls
'******************************
 Readeeprom B , 1

'******************************
If Pinc.2 = 1 Then Goto S                                   'Gosub S
'******************************

If B = Code Then
Door_open = 1
Code = "Opened"
Locate 1 , 11
Lcd "w"
Locate 2 , 4
Lcd Code
Wait 2
Door_open = 0
Code = "tak Cards"
End If
Next N
   '******************************
Locate 2 , 4
Lcd Code
Waitms 600

Loop
End

'*****************************

 S:



For N = 0 To 512 Step 65
K = "0000000000"
Writeeeprom K , N
Waitms 10
Next N
N = 0
H = 1
Do
Cls
Locate 1 , 4
Lcd "Save user"
Locate 2 , 1
Lcd "(" ; H ; "):" ; Code
Waitms 600
If Pinc.2 = 1 Then
Writeeeprom Code , N
Code = "Successful"
Locate 2 , 1
Lcd "(" ; H ; "):" ; Code
Waitms 2000

N = N + 65
Incr H
Code = "next tag"

If H = 5 Then
Locate 2 , 1
Lcd "(" ; H ; "):" ; "Memory Full"
Waitms 3000
N = 0
H = 1

'******************************
End If
End If

'******************************
 If Pinc.3 = 1 Then Goto F


Loop
صفحه‌ها: 1 2 3 4