2012-04-05 04:03 AM
salut,
svp jr veux interfacer une clavier 4*4 avec un stm32 par les GPIO.... comment!!svp !!! NB : je met les 4 premier pins en 1 GPIO_SetBits(GPIOA,GPIO_Pin_0); GPIO_SetBits(GPIOA,GPIO_Pin_1); GPIO_SetBits(GPIOA,GPIO_Pin_2); GPIO_SetBits(GPIOA,GPIO_Pin_3);et j'esaye de faire le test sur les autres 4 pins !!!
#4x4-keypad2012-04-05 06:36 AM
hvis jeg forstod hvad du mente, kunne jeg sikkert hjelpe.
Erik2012-04-07 04:45 AM
Erik wrote, ''
If I
understood
what
you meant
, I could
certainly help
.
'' Google is your friend. Have a look at http://extremeelectronics.co.in/avr-tutorials/4x3-matrix-keypad-interface-avr-tutorial/ or google ''4 x 4 keypad interface''.Erik a écrit
,«
Si j'ai bien comprisce que vous entendez
,je pourrais certainement
vous aider.
''
Google est votre ami
.Jetez un oeil à
http://extremeelectronics.co.in/avr-tutorials/4x3-matrix-keypad-interface-avr-tutorial/
ou
''4
x interface
clavier à 4
''.
2012-04-07 05:17 AM
Perhaps you can provide more details about how you have this wired up, most simple implementations use 8 pins, 4 outputs, 4 inputs.
For the output, one might typically use Open Collector/Drain mode and cycle/scan the ouputs to zero one at a time, while reading back the 4 inputs to divine which keys are depressed. ie 1110 1101 1011 0111https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Programming keypad 4x4 using encoder 16 key on STM32VL&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=77
2012-04-07 07:24 AM
if ((GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0)&&(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_4))))
{
GPIO_SetBits(GPIOC,GPIO_Pin_8);
Delay(0X1AAAA);
}
if ((GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_1)&&(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_4))))
{
GPIO_SetBits(GPIOC,GPIO_Pin_9);
Delay(0X1AAAA);
}
if ((GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_2)&&(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_4))))
{
GPIO_ResetBits(GPIOC,GPIO_Pin_8);
Delay(0X1AAAA);
}
if ((GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_3)&&(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_4))))
{
GPIO_ResetBits(GPIOC,GPIO_Pin_9);
Delay(0X1AAAA);
}
and i doo this for all line ... but !! :'(
2012-04-08 05:13 AM
Please also refer to diagram in ATMEL document in previously cited thread, or provide diagram of you own keypad connectivity.
PA0..3 Outputs (Open Drain)
PA4..7 Inputs (100K Pull-Ups)
// Set outputs High (Open Drain GPIOs, ie undriven in high state)
GPIO_SetBits(GPIOA,GPIO_Pin_0);
GPIO_SetBits(GPIOA,GPIO_Pin_1);
GPIO_SetBits(GPIOA,GPIO_Pin_2);
GPIO_SetBits(GPIOA,GPIO_Pin_3);
...
// Bring each output scan line low, wait briefly, then read the LOW input states
// to identify buttons depressed.
GPIO_ResetBits(GPIOA,GPIO_Pin_0); // Drive LOW
Delay(100);
if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_4) == RESET) // LOW indicates pressed/closed
GPIO_SetBits(GPIOC,GPIO_Pin_8);
if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_5) == RESET)
GPIO_SetBits(GPIOC,GPIO_Pin_9);
if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_6) == RESET)
GPIO_ResetBits(GPIOC,GPIO_Pin_8);
if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_7) == RESET)
GPIO_ResetBits(GPIOC,GPIO_Pin_9);
GPIO_SetBits(GPIOA,GPIO_Pin_0); // Release HIGH
// Repeat for PA.1 .. PA.3
2012-04-09 06:02 AM
// Set outputs High (Open Drain GPIOs, ie undriven in high state)
having no (at leastvery limited) understanding of thefrench entries in this english language forum Ido not know if this is already mentioned. The above ''undriven in high state
'' is not totally true. The outputs MUST bepulled highby (external) resistors for this to work. I recall two previous incidents (in other fora) where this was 'forgotten'. 'external' in paramthesis since the internal pullup probably is too weak for any significant cable length. Erik2012-04-09 07:11 AM
And thus the indirect reference to a specific document with a diagram, and specific comment that PA4..7 have 100K pull-ups. This while weak, should be quite adequate, absent some capacitance to slow the rise time. And I'm not talking about the wildly variable poly-silicon structures in the gate cell, but rather the 100K external resistance diagrammed. I would have pasted the ASCII art version, but the formatting was totally broken by Adobe and the clip-board.
I did make a specific request for circuit details, and in there absence I defined my own conditions.2012-04-11 02:22 AM
Thank You Clive ...
Work correctly2013-06-12 03:15 AM
He,
is it possible that You share complete code for Keypad please. regards Joerg