ورود به حساب ثبت نام جدید فراموشی کلمه عبور
برای ورود به حساب کاربری خود، نام کاربری و کلمه عبورتان را در زیر وارد کرده و روی «ورود به سایت» کلیک کنید.





اگر فرم ورود برای شما نمایش داده نمیشود، اینجا را کلیک کنید.









اگر فرم ثبت نام برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.









اگر فرم بازیابی کلمه عبور برای شما نمایش داده نمی‌شود، اینجا را کلیک کنید.






جهت تبلیغ در وب سایت ECA کلیک کنید.

کاربران برچسب زده شده

نمایش نتایج: از 1 به 2 از 2
  1. #1
    2012/04/03
    تهران
    237
    3

    مشکل در مدار قفل دجیتال با اسمارت کارت

    سلام به دوستان
    من یک مدار قفل دجیتال با اسمارت کارت (محمود حسنی پژو) گرفته ام و مدارشو بسته ام اما بازر یه ریز صدا میکند و سون سگمنت های ان که باید روشن شود روشن نمیشود :angry:


    لینک مدار و توضیحات: http://ir2up.ir/up17/0457bed4fb1.pdf










    کد:
           $regfile = "M16def.dat"
    $crystal = 8000000
    
    '--------------------------- ALIAS
    
    '------------------------- THIS PIN CONNECT TO CARD READER SENSOR
    '------------------------- PIN = 1 WHEN USER INSERT CARD
    
    Sensor Alias Pind.5
    Config Sensor = Input
    Portd.5 = 1
    
    '------------------------- THIS PIN CONNECT TO PUSH BOTTON
    '------------------------- PIN = 0 WHEN USER PUSH THIS BOTTON
    
    Key Alias Pind.6
    Config Key = Input
    Portd.6 = 1
    
    '------------------------ THIS PIN CONNECT TO BUZZER
    
    Buzzer Alias Portd.7
    Config Buzzer = Output
    Portd.7 = 0
    
    '----------------------- THIS PIN CONNECT TO RELAY FOR OPEN THE DOOR
    
    Relay Alias Portc.0
    Config Relay = Output
    Relay = 0
    
    '-------------------- J1 & J2 PINS CONNECT TO JUMPER
    '-------------------- IF J1 CONNECT TO J2 THEN PROGRAM DELETE THE MASTER USER
    
    J1 Alias Portc.1
    Config J1 = Output
    Portc.1 = 0
    
    
    J2 Alias Pinc.2
    Config J2 = Input
    Portc.2 = 1
    
    '------------------- 7-SEG CONNECT TO THIS PORT
    
    7_seg Alias Porta
    Config 7_seg = Output
    
    '------------------- THIS PIN CONNECT TO SMART CARD
    
    Io Alias Pinb.0
    Rst Alias Portb.1
    Clk Alias Portb.2
    Config Io = Input
    Config Rst = Output
    Config Clk = Output
    
    
    '------------------------- DIM
    
    '----
    
    Dim Card_cod(11) As Byte
    Dim Cod_e(30) As Eram Byte
    Dim Cod(30) As Byte
    
    '----
    
    Dim Conter0 As Byte
    Dim Conter1 As Byte
    Dim Conter2 As Byte
    Dim Conter3 As Byte
    Dim Conter4 As Byte
    
    Dim Time1 As Word
    Dim Time2 As Word
    Dim Time3 As Word
    
    Dim Select1 As Bit
    Dim Select2 As Byte
    
    Dim Error As Byte
    Dim Status As Byte
    Dim User_num As Byte
    
    
    '--------------------- LOAD E2PROM DATA
    
    For Conter1 = 1 To 30
    Cod(conter1) = Cod_e(conter1)
    Waitms 10
    Next
    
    '------------------------- PERUSE JUMPER CONNECTION
    '------------------------- IF J1 CONNECT TO J2 SO PROGRAM DELETE THEMASTER USER
    
    J1 = 1
    Waitms 10
    If J2 = 1 Then
     J1 = 0
     Waitms 10
     If J2 = 0 Then
      Cod(1) = 0
      Buzzer = 1
      7_seg = &B01110011
      Waitms 800
      Buzzer = 0
      Waitms 300
     End If
    
    End If
    
    J1 = 0
    
    
    '------------------------ PROGRAM START
    
    Buzzer = 1
    7_seg = 255
    Waitms 100
    7_seg = 0
    Buzzer = 0
    Waitms 300
    7_seg = 255
    Buzzer = 1
    Waitms 100
    '7_seg = 0
    
    Buzzer = 0
    Waitms 500
    
    '------------------------ IF COD(1) <> 1 THEN MASTER USER NOT REGISTERED
    '------------------------ SO NEW MASTER USER SAVE TO RAM
    
     Start_program:
    
    If Cod(1) <> 1 Then
    
    7_seg = &B00110110
    
    Bitwait Sensor , Set
    
    Waitms 100
    
    If Sensor <> 1 Then Goto Start_program
    
    Gosub Read_data
    
    If Error <> 0 Then
      7_seg = &B01001111
      Buzzer = 1
      Waitms 800
      Buzzer = 0
      Wait 1
      Goto Start_program
    
    End If
    
    Gosub Register_new_card
    7_seg = &B01000010
    Buzzer = 1
    Gosub Save_to_eram
    Buzzer = 0
    Waitms 100
    Buzzer = 1
    Waitms 100
    Buzzer = 0
    
    
    Wait 1
    
    
    End If
    
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir ******************* START MAIN PROGRAM LOOP    ****************
    '******************************                 ****************
    '*******************************************************************************
    
    Do
    '----------------------------------------------- DO
    
    7_seg = 1
    
    For Conter0 = 1 To 11
    
    Waitms 100
    
    
    Shift 7_seg , Left
    If 7_seg > 63 Then 7_seg = 1
    
    If Key = 0 Then
     Incr Time1
    Else
     Time1 = 0
    End If
    
    '--------------------- IF USER INSERTED THE CARD SO GOSUB OPEN_DOOR
    
    If Sensor = 1 Then Gosub Open_door
    
    
    Next
    
    '--------------
    Waitms 100
    7_seg = 0
    Waitms 200
    7_seg = &B10000000
    Waitms 200
    
    '--------------------- IF USER INSERTED THE CARD SO GOSUB OPEN_DOOR
    
    
    If Sensor = 1 Then Gosub Open_door
    
    7_seg = 0
    Waitms 200
    7_seg = &B10000000
    Waitms 200
    7_seg = 0
    
    '------------------- TIME > 3 WHEN USER PUSHED AND HOLD THE BOTTON
    '------------------- SO PROGRAM GO TO MENU
    
    If Time1 > 3 Then Gosub Menu
    
    
    '----------------------------------------------- LOOP
    Loop
    
    '*******************************************************************************
    '**************************                   ****************
    '* iseee.ir *************** END OF MAIN PROGRAM AND START SUB ****************
    '**************************                   ****************
    '*******************************************************************************
    
    
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir *******************       OPEN DOOR      ****************
    '******************************                 ****************
    '*******************************************************************************
    
    
    Open_door:
    
    Gosub Read_data
    Gosub Search
    
    If Error = 0 And Status = 5 Then
    
     Relay = 1
     7_seg = &B00110111
     Buzzer = 1
     Waitms 100
     Buzzer = 0
     Waitms 200
     Buzzer = 1
     Waitms 100
     Buzzer = 0
     Waitms 700
     Gosub Diplay_un
     Relay = 0
     Waitms 1500
     7_seg = 0
     Waitms 500
    
    Else
    
     7_seg = &B01001111
     Buzzer = 1
     Waitms 900
     Buzzer = 0
     Wait 2
    End If
    
    
    
    
    
    Return
    
    
    '*******************************************************************************
    '******************                          **********
    '* iseee.ir ******* MENU OF PROGRAM FOR REGISTER NEW OR DELETE USER **********
    '******************                          **********
    '*******************************************************************************
    
    Menu:
    
    
    7_seg = &B00110110
    Buzzer = 1
    Waitms 300
    Buzzer = 0
    
    Time1 = 0
    
    '-------------------------- INCR TIME1 TO EXIT SUB WHEN TIME OUT
    
    While Time1 < 70
    
     Waitms 100
     Incr Time1
     If Time1 > 50 Then Return
    
     '--------------------- WAIT UNTIL INSERT MASTER CARD
     If Sensor = 1 Then
      Gosub Read_data
      Gosub Search
    
      '----------------------- ONLY MASTER USER ALLOW TO ACCESS
    
      If Error = 0 And Status = 5 And User_num = 1 Then
       Exit While
      Else
       Buzzer = 1
       7_seg = &B01001111
       Waitms 700
       Buzzer = 0
       7_seg = 0
       Return
      End If
    
      '-----------------------
    
     End If
    
     '--------------------
    
    Wend
    
    '------------------------
    
    
    Buzzer = 1
    7_seg = &B01011110
    Waitms 100
    Buzzer = 0
    Waitms 100
    Buzzer = 1
    Waitms 100
    Buzzer = 0
    Waitms 500
    
    
    
    '-------------------------- SELECT1 = 1 ---> REGISTER NEW
    '-------------------------- SELECT1 = 0 ---> DELETE USER
    Select1 = 1
    7_seg = &B01000010
    '--------------------------
    
    Time1 = 0
    Time2 = 0
    
    '-------------------------- INCR TIME1 TO EXIT SUB WHEN TIME OUT
    
    While Time1 < 70
    
    Incr Time1
    
    Waitms 100
    
    If Key = 0 Then
     Time1 = 0
     Incr Time2
    End If
    
    
    '------------------------------ IF KEY=1 AND TIME2 >0 ---> USER PUSHED THE KEY
    '------------------------------ SO PROGRAM CHANGE THE SELECTION
    
    If Time2 > 0 And Time2 < 20 And Key = 1 Then
    Time2 = 0
    Buzzer = 1
    Toggle Select1
    
    '---------------------- DISPLAY r OR d FOR REGISTER OR DELETE USER IN 7-SEG
    
    If Select1 = 1 Then 7_seg = &B01000010
    If Select1 = 0 Then 7_seg = &B01110011
    '---------------------
    Waitms 100
    Buzzer = 0
    End If
    
    
    
    '----------------------- IF TIME2>15 THEN USER PUSHED AND HOLD THE KEY
    '----------------------- SO PROGRAM START THE SELECTED ACTION
    
    If Time2 > 15 Then
      '------------------------------------ SELECT1=1 ---> REGISTER NEW CARD
      If Select1 = 1 Then
    
       7_seg = &B00110110
       Buzzer = 1
       Waitms 200
       Buzzer = 0
    
        '----------------------------
        Time1 = 0
        While Time1 < 70
    
         Waitms 100
         Incr Time1
         If Sensor = 1 Then Exit While
    
    
        Wend
    
        If Time1 > 69 Then Return
    
        '----------------------------
        Waitms 100
    
        Gosub Read_data
        Gosub Search
        '------------------------ IF STATUS=5 THEN CARD ALREADY REGISTERED
        If Status = 5 Then
    
          Buzzer = 1
          '------------- DISPLAY (S) IN 7-SEG
          7_seg = &B01101101
          '-------------
          Waitms 100
          Buzzer = 0
          Waitms 50
          Buzzer = 1
          Waitms 100
          Buzzer = 0
          Waitms 50
          Buzzer = 1
          Waitms 100
          Buzzer = 0
          Waitms 50
          Buzzer = 1
          Waitms 100
          Buzzer = 0
          '--------------
          Waitms 1500
          Return
    
        End If
    
        '-----------------------------------------------------------------
    
        If Error = 0 Then
    
         '-------------- IF USER PUSH KEY SO SAVE NEW CARD COD FOR MASTER USER
    
         If Key = 0 Then
           Waitms 100
           If Key = 0 Then Cod(1) = 0
         End If
         '--------------------------------------------------------------------
           Gosub Register_new_card
    
         '------------------------- IF STATUS=20 SO MEMORY IS FULL
    
         If Status = 20 Then
    
         '------------ DISPLAY (F) IN 7-SEG
           7_seg = &B01000010
         '-------------------
           Buzzer = 1
           Waitms 100
           Buzzer = 0
           Waitms 100
           Buzzer = 1
           Waitms 100
           Buzzer = 0
           Waitms 600
           Gosub Save_to_eram
         Else
          '----------- IF STATUS <> 20 SO NEW CARD REGISTERED SUCCESSFULLY
          '----------- DISPLAY (r) IN 7-SEG
          7_seg = &B01000010
           Buzzer = 1
           Waitms 600
           Buzzer = 0
           Waitms 300
    
    
    
         End If
    
         '-------------------------
    
        Else
         7_seg = &B01001111
         Buzzer = 1
         Waitms 600
         Buzzer = 0
    
        End If
    
      End If
    '------------------------------------ SELECT1=0 ---> DELETE USER
      If Select1 = 0 Then
    
      7_seg = &B01110011
      Buzzer = 1
      Waitms 500
      Buzzer = 0
    
      User_num = 2
      Gosub Diplay_un
      Time1 = 0
      Time2 = 0
    
      '-------------------------- INCR TIME1 TO EXIT SUB WHEN TIME OUT
    
      While Time1 < 70
    
    
       Waitms 100
       Incr Time1
    
       If Key = 0 Then
         Time1 = 0
         Incr Time2
       End If
    
    
       '-------------------------- IF KEY=1 AND TIME2 >0 ---> USER PUSHED THE KEY
       '-------------------------- SO PROGRAM INCR USER NUMBER
    
       If Time2 > 0 And Key = 1 Then
         Time2 = 0
         Buzzer = 1
         Incr User_num
         Waitms 100
         Buzzer = 0
         If User_num > 5 Then User_num = 2
         Gosub Diplay_un
    
       End If
    
       '----------------------- IF TIME2>15 THEN USER PUSHED AND HOLD THE KEY
       '----------------------- SO PROGRAM DELET THE SELECTED USER
    
       If Time2 > 15 Then
    
       Gosub Delete_user
    
         Return
       End If
    
      Wend
      '-------------------------- TIME OUT WHILE END
    
      End If
    
    '-------------------------------------
    
    Wait 1
    Return
    End If
    
    '------------------------
    
    Wend
    
    
    
    Return
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir *******************   DISPLAY NUMBER IN 7-SEG   ****************
    '******************************                 ****************
    '*******************************************************************************
    
    Diplay_un:
    
    Select Case User_num
    Case 1:
      7_seg = &B00110000
    Case 2:
      7_seg = &B01011011
    Case 3:
      7_seg = &B01111001
    Case 4:
      7_seg = &B01110100
    Case 5:
      7_seg = &B01101101
    End Select
    
    
    Return
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir *******************    DELETE SELECTED USER   ****************
    '******************************                 ****************
    '*******************************************************************************
    
    Delete_user:
    
    Buzzer = 1
    7_seg = &B01110011
    Wait 1
    7_seg = 0
    Buzzer = 0
    
    Decr User_num
    User_num = User_num * 6
    Incr User_num
    
    Conter2 = User_num + 5
    
    For Conter1 = User_num To Conter2
     Cod(conter1) = 0
    Next
    Gosub Save_to_eram
    
    Return
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir *******************     REGISTER NEW USER    ****************
    '******************************                 ****************
    '*******************************************************************************
    
    Register_new_card:
    
    '----------------- STATUS = 30 WHEN MEMORY IS FULL
    Status = 30
    '-----------------
    
    For Conter0 = 1 To 30 Step 6
    
      If Cod(conter0) <> 1 Then
        Cod(conter0) = 1
        Incr Conter0
        Conter3 = Conter0 + 4
        Conter4 = 4
    
        For Conter2 = Conter0 To Conter3
    
            Cod(conter2) = Card_cod(conter4)
            Incr Conter4
    
        Next
        '-------------------- STATUS =20 WHEN CARD REGISTER SUCCESSFULLY
        Status = 20
        '--------------------
        Exit For
    
      End If
    Next
    
    Return
    
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir ******************* SEARCH THE CARD ID IN MEMORY  ****************
    '******************************                 ****************
    '*******************************************************************************
    
    Search:
    
    User_num = 0
    For Conter0 = 1 To 25 Step 6
      Incr User_num
    
      Status = 0
    
      If Cod(conter0) = 1 Then
       Conter3 = Conter0 + 5
       Conter4 = 4
       Conter1 = Conter0 + 1
       For Conter2 = Conter1 To Conter3
    
         If Card_cod(conter4) = Cod(conter2) Then Incr Status
         Incr Conter4
       Next
    
      End If
     If Status = 5 Then Exit For
    Next
    
    Return
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir *******************      READ CARD ID     ****************
    '******************************                 ****************
    '*******************************************************************************
    
    Read_data:
    
    Error = 0
    
    '---------------- RESET THE CARD
    '    _______
    'RST ___|    |___
    '     ___
    'CLK _____|  |_____
    
    Set Rst
    Set Clk
    Waitus 50
    Reset Clk
    Reset Rst
    Waitms 5
    
    '-------------- READ CARD DATA
    '
    '    __  __  __
    'CLK __| |__| |__| |__ .....
    
    '    __ __ __ __
    'I/O  / \/ \/ \/  .....
    '  __/\__/\__/\__/\__
    '
    '
    
    Conter0 = 1
    For Conter1 = 1 To 10
      For Conter2 = 0 To 7
        Set Clk
        Waitus 10
        Card_cod(conter0).conter2 = Io
        Waitus 20
        Reset Clk
        Waitus 30
      Next
      Incr Conter0
    Next
    
    '----------------------- IF ALL DATA IS 0 OR 255 THEN OCCUR ERROR
    
    If Card_cod(4) = 0 And Card_cod(5) = 0 And Card_cod(6) = 0 And Card_cod(7) = 0 And Card_cod(8) = 0 Then Error = 1
    
    If Card_cod(4) = 255 And Card_cod(5) = 255 And Card_cod(6) = 255 And Card_cod(7) = 255 And Card_cod(8) = 255 Then Error = 1
    
    '------------------------
    
    
    Return
    
    '*******************************************************************************
    '******************************                 ****************
    '* iseee.ir ******************* SAVE RAM DATA TO E2PROM    ****************
    '******************************                 ****************
    '*******************************************************************************
    
    Save_to_eram:
    
    For Conter4 = 1 To 30
     Cod_e(conter4) = Cod(conter4)
     Waitms 10
    Next
    
    Return
    
    
    '*******************************************************************************
    '******************************                 ****************
    '****************************** END OF PROGRAM IN       ****************
    '* iseee.ir ******************* THIS LINE = 800        ****************
    '******************************                 ****************
    '*******************************************************************************
    
    End
    
    
    
    'WWW.ISEEE.IR
    'YEAR 2011
    هر اقدام بزرگی ابتدا محال به نظر میرسد
  2. #2
    2012/04/03
    تهران
    237
    3

    پاسخ : مشکل در مدار قفل دجیتال با اسمارت کارت

    کسی نمیدونه مشکل از چیه؟ :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry: :angry:
    فردا باید تحویلش بدم!!!!! :angry: :angry: :angry: :angry: :cry: :cry:
    هر اقدام بزرگی ابتدا محال به نظر میرسد
نمایش نتایج: از 1 به 2 از 2

موضوعات مشابه

  1. ماژول ریدر اسمارت کارت؟
    توسط jaafary1 در انجمن میکروکنترلرهای AVR
    پاسخ: 9
    آخرين نوشته: 2015/04/13, 17:49
  2. اطلاعاتي جامع درباره سيم کارت مدار داخل سيم کارت نحوه کار سيم احتياج داشتم
    توسط ciscosun2010 در انجمن مفاهیم پایه برق و الکترونیک
    پاسخ: 1
    آخرين نوشته: 2014/03/16, 14:57
  3. یک مشکل کوچیک در برنامه قفل رمز دجیتال
    توسط parham144 در انجمن میکروکنترلرهای AVR
    پاسخ: 2
    آخرين نوشته: 2012/03/01, 07:00
  4. یه مدار ساده برای کارت خوان کارت سوخت معرفی کنید
    توسط university در انجمن مباحث علمی عمومی
    پاسخ: 3
    آخرين نوشته: 2011/10/17, 22:57
  5. پاسخ: 8
    آخرين نوشته: 2011/07/02, 08:33

کلمات کلیدی این موضوع

علاقه مندي ها (Bookmarks)

علاقه مندي ها (Bookmarks)

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •