'-------------------------------------------------------------------------------
$regfile = "m16def.dat"
$crystal = 8000000
'-------------------------------------------------------------------------------
Config Lcdpin = Pin , Db4 = Pind.3 , Db5 = Pind.4 , Db6 = Pind.5 , Db7 = Pind.6 , E = Pind.1 , Rs = Pind.2
Config Lcd = 16 * 2
Config Kbd = Portc , Debounce = 200 , Delay = 200
Config Timer1 = Timer , Prescale = 1
Enable Interrupts
Enable Timer1
Enable Ovf1
Config Porta = Output
'-------------------------------------------------------------------------------
Dim Pass As Eram Byte
Dim A As Byte
Dim B As Byte
Dim I As Byte
Dim Chek As Byte
Dim C As Byte
'-------------------------------------------------------------------------------
Pass = 222
B = 0
C = 0
'-------------------------------------------------------------------------------
Main1:
Cls
Home
Lcd " enter pasword"
Wait 1
'-------------------------------------------------------------------------------
Stop Timer1
Start Timer1
Timer1 = 60636
On Ovf1 Pass
'-------------------------------------------------------------------------------
Pass:
Cls
Home
C = C + 1
If C > 200 Then
Goto M1
Else
Goto M
End If
'-------------------------------------------------------------------------------
M:
A = Getkbd()
A = Lookup(a , Read_key)
If A > 15 Then Goto M
If A = 13 Then Goto Mm
Waitms 500
Lcd A
B = B * 10
B = B + A
Goto M
'-------------------------------------------------------------------------------
End 'end program
'-------------------------------------------------------------------------------
Mm:
B = A
If A = Pass Then
Goto Main2
Waitms 500
Else
Cls
Home
Lcd "Password false"
Lowerline
Lcd "Enter Password"
Wait 2
I = I + 1
If I > 3 Then
Goto M
Else
Goto M1
End If
End If
'-------------------------------------------------------------------------------
M1:
Cls
Home
Lcd "Error Password"
'-------------------------------------------------------------------------------
Main2:
Cls
Home
Lcd " 1 cheang password"
Lowerline
Lcd " 2 exit "
Wait 2
Cls
Home
Goto M3
'-------------------------------------------------------------------------------
M3:
A = Getkbd()
A = Lookup(a , Read_key)
If A > 15 Then Goto M3
If A = 1 Then
Goto Cheang
End If
If A = 2 Then
Goto Main1
End If
'-------------------------------------------------------------------------------
Cheang:
Cls
Home
Lcd " enter new password "
Waitms 500
Cls
Home
Goto Password
'-------------------------------------------------------------------------------
Password:
B = 0
Pa:
A = Getkbd()
A = Lookup(a , Read_key)
If A > 15 Then Goto Pa
If A = 13 Then Goto Mn
Waitms 500
Lcd A
B = B * 10
B = B + A
Goto Pa
'-------------------------------------------------------------------------------
Mn:
B = A
Pass = 0
A = Pass
Goto Main1
'-------------------------------------------------------------------------------
Read_key:
Data 13 , 14 , 0 , 15 , 12 , 9 , 8 , 7 , 11 , 6 , 5 , 4 , 10 , 3 , 2 , 1,
'-------------------------------------------------------------------------------
این برنامه رو واسه پسورد نوشتم ولی جواب نمیگیرم نمدونم چرا؟

زمانی که متغیر رو eram
معرفی می کنم نیازی نیست از read o write
استفاده کنم!
$regfile = "m16def.dat"
$crystal = 8000000
'-------------------------------------------------------------------------------
Config Lcdpin = Pin , Db4 = Pind.3 , Db5 = Pind.4 , Db6 = Pind.5 , Db7 = Pind.6 , E = Pind.1 , Rs = Pind.2
Config Lcd = 16 * 2
Config Kbd = Portc , Debounce = 200 , Delay = 200
Config Timer1 = Timer , Prescale = 1
Enable Interrupts
Enable Timer1
Enable Ovf1
Config Porta = Output
'-------------------------------------------------------------------------------
Dim Pass As Eram Byte
Dim A As Byte
Dim B As Byte
Dim I As Byte
Dim Chek As Byte
Dim C As Byte
'-------------------------------------------------------------------------------
Pass = 222
B = 0
C = 0
'-------------------------------------------------------------------------------
Main1:
Cls
Home
Lcd " enter pasword"
Wait 1
'-------------------------------------------------------------------------------
Stop Timer1
Start Timer1
Timer1 = 60636
On Ovf1 Pass
'-------------------------------------------------------------------------------
Pass:
Cls
Home
C = C + 1
If C > 200 Then
Goto M1
Else
Goto M
End If
'-------------------------------------------------------------------------------
M:
A = Getkbd()
A = Lookup(a , Read_key)
If A > 15 Then Goto M
If A = 13 Then Goto Mm
Waitms 500
Lcd A
B = B * 10
B = B + A
Goto M
'-------------------------------------------------------------------------------
End 'end program
'-------------------------------------------------------------------------------
Mm:
B = A
If A = Pass Then
Goto Main2
Waitms 500
Else
Cls
Home
Lcd "Password false"
Lowerline
Lcd "Enter Password"
Wait 2
I = I + 1
If I > 3 Then
Goto M
Else
Goto M1
End If
End If
'-------------------------------------------------------------------------------
M1:
Cls
Home
Lcd "Error Password"
'-------------------------------------------------------------------------------
Main2:
Cls
Home
Lcd " 1 cheang password"
Lowerline
Lcd " 2 exit "
Wait 2
Cls
Home
Goto M3
'-------------------------------------------------------------------------------
M3:
A = Getkbd()
A = Lookup(a , Read_key)
If A > 15 Then Goto M3
If A = 1 Then
Goto Cheang
End If
If A = 2 Then
Goto Main1
End If
'-------------------------------------------------------------------------------
Cheang:
Cls
Home
Lcd " enter new password "
Waitms 500
Cls
Home
Goto Password
'-------------------------------------------------------------------------------
Password:
B = 0
Pa:
A = Getkbd()
A = Lookup(a , Read_key)
If A > 15 Then Goto Pa
If A = 13 Then Goto Mn
Waitms 500
Lcd A
B = B * 10
B = B + A
Goto Pa
'-------------------------------------------------------------------------------
Mn:
B = A
Pass = 0
A = Pass
Goto Main1
'-------------------------------------------------------------------------------
Read_key:
Data 13 , 14 , 0 , 15 , 12 , 9 , 8 , 7 , 11 , 6 , 5 , 4 , 10 , 3 , 2 , 1,
'-------------------------------------------------------------------------------
این برنامه رو واسه پسورد نوشتم ولی جواب نمیگیرم نمدونم چرا؟

زمانی که متغیر رو eram
معرفی می کنم نیازی نیست از read o write
استفاده کنم!
دیدگاه