![]() |
![]() |
![]() |
|
|
|||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Experienced Member
|
hi all .
i have a pic microcontroller and i configured the port-d as input . port-d is 8- bit, so in this case i have 8-inputs with values from 1 to 255 ,and if i connect bit0 and bit1 to vcc i get this decimal value "3" and if i connect 4*4 keypad so i have 16-inputs with corresponding value ,but in this case i cant press 2 buttons or 3 at the same time , now how can i get 16 inputs from 8-inputs and can press or enter 2 inputs in the same time and get 2 values for it ? is that possible ? am thinking for 2 days and i cant get it . regards .
__________________
jax |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
If this link does not work search michrochip.com for application note 529.
http://ww1.microchip.com/downloads/e...tes/00529e.pdf I do not understand what you are doing and it might take 2 days to understand it. See application note. Normally a 4x4 keypad takes 8 pins from a micro. 4 pins as outputs and 4 pins as inputs. The keyboard is often thought as A,B,C,D and 1,2,3,4. Output 1000,xxxx to test if column A. Input xxxx,???? To see if A1, A2, A3, A4. Output 0100,xxxx to test if column B. Input xxxx,???? To see if B1, B2, B3, B4. Output 0010,xxxx to test if column C. Input xxxx,???? To see if C1, C2, C3, C4. Output 0001,xxxx to test if column D. Input xxxx,???? To see if D1, D2, D3, D4. |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
first thanks for reply ,
but i think you miss understand somthing . to be come more understandable and reliable . think about this 4*4 keypad as 16 "DIP SWITCH" and if you turn on switch no.1 then you will recive "xx" value . but what if i turned on switch no.1 , no.2 ,no.3,no.4? in this case what will be the result ? understand what i mean , thanks . regards
__________________
jax |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
8 bits are enough for a keypad of 4X4.
Use a matrix of 4 lines and 4 colomns. |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
A key matrix is not intended to work with more than one switch closed.
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
in other words , i need to get 16 inputs from 8 input , and every bit in this input have a unique value , so i can enter 2 or 3 input at time . and get its values .
thanks , regards .
__________________
jax |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Amenoera,
If I understand right you are not using a 4x4 keypad but dip switches. You need to add diodes on every switch then you can see multiple closed keys. http://tomscarff.tripod.com/key2midi/key2midi.gif Look at the link. |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
look at this , page 3 .
__________________
jax |
|
|
|
|
|
(permalink) | |
|
Experienced Member
|
Quote:
Last edited by Mike, K8LH; 9th February 2008 at 05:42 PM. |
|
|
|
|
|
|
(permalink) |
|
Experienced Member
|
i have an idea but i dont know if it can work ?
what i program the pic to that : "if bit0 & bit1 high then send value x - if bit3 & bit4 high then send value xx - if bit1 & bit6 high then send value xy" etc . . for only 16 input ? or am wrong ? thanks
__________________
jax |
|
|
|
|
|
(permalink) |
|
Experienced Member
|
Amenoera,
I think your “page 3” example will not work. The switches are “DIP Switches” so many may be closed. These are not key but switches. Example: Close switch A0 through 7 and switch B3 all other are open RA3,2,1,0 = 1111b RB7,6,5,4,3,2,1,0, = 11111111 Scan switches RA3,2,1,0 = 1110b RB7,6,5,4,3,2,1,0, = 00000000 RA3,2,1,0 = 1101b RB7,6,5,4,3,2,1,0, = 00000000 RA3,2,1,0 = 1011b RB7,6,5,4,3,2,1,0, = 11111111 RA3,2,1,0 = 0111b RB7,6,5,4,3,2,1,0, = 11111111 Problem: When switch A 0 through 7 are closed it shorts RB7,6,5,4,3,2,1,0 together. This is why I suggested adding diodes. Diodes work, I have done this. See old message. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Problems switchin relay with PIC | Andy1845c | General Electronics Chat | 5 | 17th November 2007 06:13 PM |
| HD44780 lcd help | jay543_uk | Micro Controllers | 12 | 8th November 2007 03:26 PM |
| PIC ASM - Summation two 16 bit numbers (16f84) | byrusber | Micro Controllers | 10 | 28th October 2007 08:40 PM |
| High ADC sampling rate PIC, 18F needed? | bananasiong | Micro Controllers | 24 | 28th October 2007 12:13 PM |
| RS232 Converter | e.chain | Micro Controllers | 0 | 6th October 2007 06:19 PM |