AnsweredAssumed Answered

keypad interfacing example

Question asked by Serdar Ozturk on Jun 11, 2009
Latest reply on Jun 12, 2009 by Serdar Ozturk

Dear all;

 

I am looking for an example code for interfacing a 96AB2 keypad with a 9S12DP256B MCU.

 

Currently I am stuck with a nonworking code from an old book.  I've connected pins of the keypad to PORT A and the code goes as follows

 

DDRA = 0xF8; // set PORTA[0:2] as input and PORTA[3:7] as output

 

for (;:smileywink: {

  PORTA = 0xBF; // assert row 0

  keypress = PORTA;

  if (keypress != 0xBF) // some key has been pressed

    key = scan_key(keypress);

 

...

 

I've a similar block for every row but I'm not even sure if this is the correct way of doing that and unfortunately I am not getting any results with it.  I would really appreciate if someone could give me some hints or pointers to a working code.

 

Thanks in advance.

Outcomes