پروژه های ramin.yousefi2@gmail.com AVR,ARM,PIC,8051

لطفا ایمیل بزنید

راه اندازی صفحه کلید با بسکام
 


'-------------------------- KEYREAD PROGRAM ------------------------------------
$regfile = "m16def.dat"
'internal 1mhz rc osc is default
$crystal = 1000000
Dim A(4) As Word , Result As Word , Kbd As Byte , I As Byte
'Config Portd = Output
Config Lcdpin = Pin , Db4 = Pinb.4 , Db5 = Pinb.5 , Db6 = Pinb.6 ,
Db7 = Pinb.7 , _
Rs = Pinb.2 , E = Pinb.3
Config Lcd = 16 * 2
Config Kbd = Porta , Delay = 100
Main:
I = 0
Cursor Off
Cls : Home
Lcd " YOUR CODE IS: "
Lowerline
Lcd " "
Program_start:
Kbd = Getkbd()
If Kbd > 15 Then Goto Program_start
Kbd = Lookup(kbd , Data_for_keyboard)
Incr I
A(i) = Kbd
Lcd " *"
Waitms 250
If I < 4 Then Goto Program_start
A(1) = A(1) * 1000
A(2) = A(2) * 100
A(3) = A(3) * 10
Result = A(1) + A(2)
Result = Result + A(3)
Result = Result + A(4)
Cls : Home
Lcd "YOUR FINAL ENTER"
Home L
Lcd Result
Do
Loop
'----------------------- DTAT LOOKUP TABLE -------------------------------------
Data_for_keyboard:
Data 1 , 2 , 3 , 10 , 4 , 5 , 6 , 11 , 7 , 8 , 9 , 12 , 13 , 0 , 14 , 15