LEONARDO FABIO SANDOVAL LOZANO

KBI and Port I/O

Discussion created by LEONARDO FABIO SANDOVAL LOZANO on Jan 24, 2011
Latest reply on Jan 25, 2011 by bigmac

Hello everybody 

 

I'am scripting a MC9S08SE8CLR and I found my self in trouble with this:

 

I already have the KBI working properlly but I want to USE A PTA ping to control a display, so I can display a huendred counter. The question is, Can I use the KBI and the the PTA in pin at the same time ???, and how would you do it??

 

Another thing is that I make the KBI in one variable like this 

 

 

if (--KBI_Debounce == 0){
             KBI_ProcessKey =0;
             auxptb=PTBD;
             ProccesKey((PTAD|0b11110000) & ((auxptb<<4)|0b00111111)); // de esta forma los puertos A&B queden en una sola variable 
             InitKBI(KBISC|0b11001111);
          }

 

if (--KBI_Debounce == 0){             KBI_ProcessKey =0;             auxptb=PTBD;             ProccesKey((PTAD|0b11110000) & ((auxptb<<4)|0b00111111)); // de esta forma los puertos A&B queden en una sola variable              InitKBI(KBISC|0b11001111);          }

 

 

void InitKBI(byte KBIpin) { 

  KBISC_KBIE=0;

  KBIPE = KBIpin;       //enable KBI pin

  KBISC = KBISC_KBIE_MASK|KBISC_KBACK_MASK;         //enable KBI int and clear KBF

} //end InitKBI

Many Thanks 
I really appreciate examples about it 
Leo Sandoval

Outcomes