8-bit to 16-bit pic ? is that possible ?

Status
Not open for further replies.

amenoera

New 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 .
 
If this link does not work search michrochip.com for application note 529.
https://www.electro-tech-online.com/custompdfs/2008/02/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.
 
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
 
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 .
 
ronsimpson said:
A key matrix is not intended to work with more than one switch closed.
Actually, you can decode multiple concurrent key presses on a multiplexed 4x4 keypad quite easily... Unfortunately it may not do what the OP would like because it's difficult to press more than one key at exactly the same time and if the keys are located in different scanned columns (or rows) they might be detected at different times (during a different scan period) unless the keypad code scans all four columns (or rows) sequentially before returning with key press bit results...
 
Last edited:
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
 
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.
 

Attachments

  • Image1.jpg
    90.4 KB · Views: 164
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…