Shop OBEX P1 Docs P2 Docs Learn Events
remap keys 4x3 — Parallax Forums

remap keys 4x3

dbjdbj Posts: 75
edited 2006-11-29 12:37 in General Discussion
Cant quite get how this works try to remap keys four 3x4 key pad insted of a 4x4 tried to eliminate the collum 4 and move $a and $b but get stange results now the 4 key is 5 , 5 key is 6 , 6 is 7 is 9 , 8 is E, 9 is 0
why is there two 6 s key 5 and key 0.·Now you are only scaning 3 collums and not four so remp keys like·so
·ReMap:
· DATA·· 1,· 2,· 3
· DATA·· 4,· 5,· 6
· DATA·· 7,· 8,· 9
· DATA· $A,· 0, $B

remove and change

·FOR tmpB2 = 1 TO·3··· chage to 3 insted of 4···············' scan·three rows
··· IF Col1 = Yes THEN EXIT························· · ' check buttons on column
··· INC tmpB1··········································· ··' update key value
··· IF Col2 = Yes THEN EXIT
··· INC tmpB1
··· IF Col3 = Yes THEN EXIT
··· INC tmpB1
··'·············· ·" IF Col4 = Yes THEN EXIT"····delete this row

··· INC tmpB1
··· Keys = Keys >> 1····························· ·· ' select next row
··· Keys = Keys | %0000_1000··················· ' clear previous row
· NEXT
· RETURN tmpB1


this is what·controls the scaning but how is it out of sequence

GET_KEY:
· tmpB1 = 0···································· ' reset keyboard value
· Keys = %0000_0111···························· ' activate first row
· TRIS_Keys = %1111_0000······················· ' refresh IO state
· PLP_Keys = %0000_1111························ ' pull-up input pins
· DATA· %00111111······························ ' 0
· DATA· %00000110······························ ' 1
· DATA· %01011011······························ ' 2
· DATA· %01001111······························ ' 3
· DATA· %01100110······························ ' 4
· DATA· %01101101······························ ' 5
· DATA· %01111101······························ ' 6
· DATA· %00000111······························ ' 7
· DATA· %01111111······························ ' 8
· DATA· %01100111······························ ' 9
· DATA· %01110111······························ ' A
· DATA· %01111100······························ ' B

Thanks for the help




·

Comments

Sign In or Register to comment.