PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : درخواست ادیت برنامه قفل رمز



tesla940
23-12-2014, 17:47
سلام برنامه قفل رمز زیر یک برنامه کامله فقط باید برای
اینکه میخوام 12 رقم رو هم بهش اضافه کنم(یعنی کدی بین 4تا 12 رقم قبول کنه)باید دیمانسیون aوcode رو به string تغییر بدم.
بعد از تغییر در بخشهایی مثل


A = A * 10
A = A + Key(i)

ارور میگیره که نمیدونم چطور باید اصلاح بشه؟اگه کسی بتونه کمک کنه ممنون میشم....

خیلی به این برنامه نیاز دارمcry::cry::


$regfile = "m16adef.dat"
$crystal = 8000000
Config Lcdpin = Pin , Db4 = Pc.0 , Db5 = Pc.1 , Db6 = Pc.2 , _
Db7 = Pc.3 , Rs = Pc.4 , E = Pc.5
Config Lcd = 16 * 2
Config Portc.6 = Output
Config Portc.7 = Output
Config Pina.0 = Input
Config Kbd = Portd , Debounce = 250 , Delay = 200
Dim Change As Byte
Dim Key(13) As Byte , I As Byte , A As long , Code As long , Error As Byte
Key(13) = 20
Change = 0 : Code = "9999999"


Gosub Main
Main:
Do
If Change = 0 Or Change = 1 Then
Cls : Home : Lcd "enter pass="
End If
If Change = 2 Then
Cls : Home : Lcd "enter new pass="
End If
Locate 2 , 1
For I = 1 To 13
L1:
Key(i) = Getkbd()
If Key(i) = 16 Then Goto L1
Key(i) = Lookup(key(i) , Dat1)
If Key(i) = 20 Then
If Change <> 2 Then Change = 1
Goto L1
End If
If Key(i) = 15 Then
Select Case I
Case 1 To 4:
Cls : Home : Lcd "limit digit num"
End Select
Exit For
End If

If Key(13) < 10 Then
Locate 1 , 1 : Lcd "error key"
Goto L1
End If

Lcd "*"
A = A * 10
A = A + Key(i)

Next
Wait 1

If A = Code And Change = 1 Then
Cls : Lcd "correct pass"
Wait 2
A = 0 : Error = 0 : Change = 2
Gosub Main
End If

If Change = 2 And I > 3 Then
Code = A
Cls : Lcd "Change pass"
Wait 2
A = 0 : Error = 0 : Change = 0
Reset Portc.6
Reset Portc.7
Gosub Main
End If


If A = Code Then
Error = 0
Set Portc.6
Reset Portc.7
Cls : Lcd "correct pass"
Else
Change = 0
Reset Portc.6
Set Portc.7
Cls : Lcd "invalid pass"
Incr Error
End If


If Error = 3 Then
Cls : Lcd "key disabled"
Bitwait Pina.0 , Set
Cls : Lcd "key enable"
Error = 0
End If

Wait 2
A = 0
Reset Portc.6
Reset Portc.7

Loop
Return
End
Dat1:
Data 1 , 2 , 3 , 10 , 4 , 5 , 6 , 11 , 7 , 8 , 9 , 12 , 15 , 0 , 20 , 13

tesla940
26-12-2014, 18:57
حل شد!:mrgreen: