View previous topic :: View next topic |
Author |
Message |
EKREMhbx
Joined: 06 Jun 2005 Posts: 27
|
Posted: Thu Oct 13, 2005 9:35 am Post subject: 8*6 matrix keyboard |
|
|
hello
I want to make 8*6 matrix keyboard whi my m32
so
- config porta=output ' use 8 pin for column output
- config portc = input ' use 6 pin for row (portc 2 to portc 7) input
set portc
do
reset porta.1
waitms 10
lcd pinc
set porta
"
"
"
"
"loop
my program flow is below but I dont recognize wright button code
what is the wrong
I need help
thank you |
|
Back to top |
|
|
DToolan
Joined: 14 Aug 2004 Posts: 1384 Location: Dallas / Fort Worth, Texas (USA)
|
Posted: Fri Oct 14, 2005 12:04 am Post subject: |
|
|
I'm not sure what your exact problem is (I'm guessing english is not your native language), but the "SET" keyword is used for individual bit manipulation only. Although Bascom accepted your attempt to "SET" an entire port (and it compiled without error), it does not do that. You can't "SET" a byte or a port... only individual bits. The same is true for the keyword "RESET".
For your ports, you should use something like PortC = &HFF or PortA = &HFF. Your use of "Reset PortA.1" for a single bit is correct. |
|
Back to top |
|
|
Duval JP
Joined: 22 Jun 2004 Posts: 1161 Location: France
|
Posted: Fri Oct 14, 2005 6:42 pm Post subject: |
|
|
Hi,
Try this one and look at the idea to keep the result "Memoire_clavier" variable, a loop into a loop.
Very low noisy keyboard and debounce perfect!
I use a 4 X 3 matrix keyboard where the user needs to "up" the key before the result is sending
The pin Portc.3 is use to drive a buzzer so take care about it
----------------------------------------------------------------------------
Function Key() As Byte
Local Cle As Byte , Ligne As Byte , Memoire_clavier As Byte
Do
Encore3:
Ddrc = &B00000111 'configuration des ports colonnes
Portc = 7 'envoi 1 sur les 3 colonnes
Cle = Pinc 'lit les lignes
' Locate 6 , 1 : Lcd "cle ligne " ; Cle
Select Case Cle
Case 23 '31 without buzzer
Ligne = 1
Case 39
Ligne = 4 ' Ligne 2
Case 71
Ligne = 7
Case 135
Ligne = 10
Case Else
Goto Encore3
End Select
Waitms 50
'Wait 1
Ddrc = &B11110000 'configuration des ports lignes
Portc = 240
Cle = Pinc
' Locate 7 , 1 : Lcd "cle colonne " ; Cle
Memoire_clavier = Cle
Select Case Cle
Case 241
Key = Ligne + 1
Case 242
Key = Ligne + 2
Case 244
Key = Ligne + 3
Case Else
Goto Encore3
End Select
Do
Cle = Pinc 'si la touche est toujours enfoncée on boucle
Loop Until Cle <> Memoire_clavier
Loop Until Key > 1
Cle = Lookup(key , Clavier)
Key = Cle
End Function
Clavier:
Data 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 100 , 0 , 200
Bon courage _________________ pleasure to learn, to teach, to create |
|
Back to top |
|
|
EKREMhbx
Joined: 06 Jun 2005 Posts: 27
|
Posted: Sat Oct 15, 2005 8:48 am Post subject: 8*6 kıeyboarsd for m32 |
|
|
thank you for your answer
I want to how I acan adaptive your code
in my 8*6 matrix keyboard project (port c row*8and porta column*6)
in this time gor one column and one row enough for me.
regards |
|
Back to top |
|
|
|
|
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
|
|