⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 magcard.bas

📁 82 sample programs written in BASCOM-8051 for 8051 developement
💻 BAS
字号:
'------------------------------------------------------------------
'                        MAGCARD.BAS
'                   (c) 2000 MCS Electronics
'------------------------------------------------------------------
'[DIM used variables]
Dim X(40) As Byte , I As Byte , Bts As Byte , Dum As Byte

'[ALIAS the pins used]
_mcs Alias P1.1
_mclock Alias P1.2
_mdata Alias P1.0

Do
  I = Inkey()                                                 'get a key
  If I = "L" Then                                             'learn mode
     Print "Learning"
     Print "Slide magcard through reader"
     Readmagcard X(1) , Bts , 5 , 100000                      'call routine
     '                        ^ may be 5 or 7. 7 bit coding not implemented yet
     '                              ^-- time out value sets ERR when time out occurs
     For I = 1 To Bts
       Writeeeprom X(i) , I
     Next
     Print "Stored"
  Else
     Print "Slide magcard through reader"
     Readmagcard X(1) , Bts , 5 , 100000                      'call routine
     '                        ^ may be 5 or 7. 7 bit coding not implemented yet
     '                              ^-- time out value sets ERR when time out occurs
     Print "Error " ; Err                                     '1 if error occured
     Print ; " " ; Bts ; " bytes read"                        'show number of bytes read

     For I = 1 To Bts
       Print X(i) ; " ";
     Next
     Print                                                    'show number
     Err = 0
     For I = 1 To Bts
       Readeeprom Dum , I
       'Print "eprom " ; Dum ; " mag " ; X(i) ;
       If Dum <> X(i) Then
          Err = 1
      '    Print "Error at " ; I
       End If
     Next
     If Err = 0 And Bts = 34 Then
        Print "Valid card"
     Else
        Print "Invalid card"
     End If
  End If

  Print
Loop
End

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -