Generating keyboard interrupts on a MC13213    GT60 controller

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Generating keyboard interrupts on a MC13213    GT60 controller

1,374 次查看
McGillMike
Contributor I
right now, i have an isr reading:
 
__interrupt voidKBI_ISR(void) {
  
  //KBI1SC =  cKBI1SC | cKBI1SC_Ack;
  if(KBI1SC & 0b00001000) //test if KBF set
  {
   KBI1SC &= 0b11111101; //disable KBIE
   //KBI1SC = cKBI1SC_Ack; //clear interrupt flag
   KBI1SC |= 0b00000100;  //clear interrupt flag                     
   PWRLib_MCU_WakeupReason.Bits.FromKBI = 1;    //set KB event flag
  }
 
 
then, in main control, i read:
 
 if (Res.Bits.FromKBI == TRUE )
    {
         LED4TOGGLE;
         debounceCounter = 0;
         while(debounceCounter<100)
           debounceCounter++;
         //while(debounceCounter<1000){;}
         debounceCounter = 0;
         /* IH_added functions to record keystroke */
         if(!(PTAD & (1<<5)))  keyPressed |= KB4;
         if(!(PTAD & (1<<4)))  keyPressed |= KB3;
         if(!(PTAD & (1<<3)))  keyPressed |= KB2;
         if(!(PTAD & (1<<2)))  keyPressed |= KB1;
         //TOGGLE_EXT_LED;
         //enable keyboard interrupts
         KBI1SC |= 0b00000010;
         keyState= KEY_PRESSED;
         /* clear kb interrupt flag */
         Res.Bits.FromKBI = FALSE;
   }
 
 
in initialisation
PTAPE = 0b00111100;
PTADD = 0b00000001;
KBIPE = 0b00111100;
 
 
 
all this changes nothing because the PTAD pins stay at 00111100 all the time, none of the 4 1s ever drop to a 0. They stay 1s from beginning of startup to termination of program. I can generate the pushbutton event, but i never get any actual response in the ports. i cannot understand why it never drops to 0. Or better yet, its never 0 to begin with.
 
thanks.
标签 (1)
0 项奖励
2 回复数

374 次查看
snaeth
Contributor I
Im a bit of a newb, so forgive me if this is completely wrong, but from first looking at it, it looks like your are enabling the pull up resisters......giving you your for 1's.......and then you have those port A pins set as input.......so they are reading the 1's.  those port A pins need to be set as output. so you can set those pins to the value you want, within the micro. 
0 项奖励

374 次查看
McGillMike
Contributor I
Actually, i fixed my problem. I wasn't checking for the right states. So youre right.
 
thanks.
0 项奖励