Posted: Mon Mar 24, 2008 4:57 am Post subject: Keyboad matrix 4*4.Little & fast code.Control butt supp
Keyboad matrix 4*4. Little & fast code. Control button support/
All question to airat_saifullin@pochta.ru
$regfile = "m128def.dat" : $crystal = 16000000 : $hwstack = 32 : $swstack = 10 : $framesize = 40 : $baud = 115200
Dim Port_tmp As Byte : Dim Bott_sh As Bit : Dim Bott_ctr As Bit : Dim Bott_tmp As Byte : Dim Bott_ent As Bit : Dim Bott_esc As Bit
Dim Bott_push As Bit : Dim Botton As Byte :
Dim Menu_col As Byte : Dim Menu_row As Byte : Dim Menu_mode_nav As Bit : Dim Menu_mode_sel As Bit : Dim Menu_data_tmp_bit As Bit :
Dim Menu_data_tmp_word As Word : Dim Menu_row_chan As Bit : Dim Menu_data_chan As Bit : Dim Menu_col_chan As Bit : Dim Menu_data_tmp_byte As Byte :
Config Lcdpin = Pin , Db4 = Porta.2 , Db5 = Porta.3 , Db6 = Porta.4 , Db7 = Porta.5 , E = Porta.1 , Rs = Porta.0
Do
Ddrc = 15
Portc = 15 : Port_tmp = Pinc : Bott_tmp = Port_tmp And 240 : If Bott_tmp = 0 Then : Reset Bott_push : Goto Bott_chek_end :
Else : Set Bott_push : Set : End If
Portc = 1 : Port_tmp = Pinc : Bott_tmp = Port_tmp And 16 : If Bott_tmp = 16 Then : Set Bott_sh : Else : Reset Bott_sh : End If : Bott_tmp = Port_tmp And 128
If Bott_tmp = 128 Then : Set Bott_ctr : Else : Reset Bott_ctr : End If : Bott_tmp = Port_tmp And 32 :
If Bott_tmp = 32 Then : Set Bott_ent : Else : Reset Bott_ent : End If :
Bott_tmp = Port_tmp And 64 : If Bott_tmp = 64 Then : Set Bott_esc : Else : Reset Bott_esc : End If
Portc = 2 : Port_tmp = Pinc : Bott_tmp = Port_tmp And 240 :
Select Case Bott_tmp
Case 16 : Botton = 1
Case 32 : Botton = 4
Case 64 : Botton = 7
Case 128 : Botton = 10
Case Else:
End Select
Portc = 4 : Port_tmp = Pinc : Bott_tmp = Port_tmp And 240 :
Select Case Bott_tmp
Case 16 : Botton = 2
Case 32 : Botton = 5
Case 64 : Botton = 8
Case 128 : Botton = 11
Case Else:
End Select
Portc = 8 : Port_tmp = Pinc : Bott_tmp = Port_tmp And 240 :
Select Case Bott_tmp
Case 16 : Botton = 3
Case 32 : Botton = 6
Case 64 : Botton = 9
Case 128 : Botton = 12
Case Else:
End Select
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum