pablo palomba

HC908AP32 - Why Buzzer on, while IRSCI INterrupt_Tx?

Discussion created by pablo palomba on Jul 2, 2007
Latest reply on Jul 25, 2007 by pablo palomba
Hello:
        I´m working on HC908AP32 and CW 5.0.
I´m using the IRSCI module to send data to a LCD, the IRSCI has Interrupts enabled, on the other hand, I enable the KBI interrupts to use it with a Matricial Keyboard, I mention this because only in this part inside the code, I power on a Buzzer on PTA5 with Bits_setVal();, but when I send a message to the LCD,  Buzzer beeps like a cricket
:smileywink: .
I would like to know, why it could be happend, and I will appreciate a lot, if anyone knows how can I avoid this failure.
Here there are some parts of code:

ISR(Teclado_Interrupt)
{
      KBSCR_IMASK=1;   //deshabilito interrupciones
      KBSCR_ACK=1;         //KeyF =0
      tecla=TRUE;   
}


void KBI1_Init(void)
{
  /* KBSCR: IMASK=1 */
  setReg8Bits(KBSCR, 0x02);            
  /* KBIER: KBIE7=0,KBIE6=1,KBIE5=1,KBIE4=1,KBIE3=1,KBIE2=0,KBIE1=0,KBIE0=0 */
  setReg8(KBIER, 0x78);                
  /* KBSCR: ACK=1 */
  setReg8Bits(KBSCR, 0x04);            
  /* KBSCR: IMASK=0 */
  clrReg8Bits(KBSCR, 0x02);            
}

 void main(void)
{
 
  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/
 
 
   LCD_ClearTxBuf();
  KBSCR_IMASK=1; 
  PantallaInicial();            // It send to LCD a welcome message
 Pausa_1S();
  KBI1_Init();
  for(;:smileywink:{
        if (tecla){
           Buzzer_SetVal();       Power on Buzzer
           Pausa_50mS();    //Enmascaro rebotes (De bounce delay)
          //reviso que tecla fue presionada
           boton=getReg8(PTD)&0x78;   //Determino por que pin de entrada se generó la interrupcion
           for (i=0;i<=1;i++){
            if (i==0){              //Fila 1
              Fila2_SetVal();
              if (KBSCR_KEYF){
              test=0x04|boton;
              break;
            }
          }else {
            Fila2_ClrVal();     //Fila 2
            Fila1_SetVal();
            if (KBSCR_KEYF){
              test=0x80|boton;
            }
        }            
     }
     Fila2_SetVal();     //ninguno provoca interrupcion
     Fila1_SetVal();
      Pausa_100mS();
      Pausa_100mS();
      Pausa_100mS();
      Buzzer_ClrVal();           Power off Buzzer

    
   switch (test){
   
        /*===========================  Flecha_Arriba ============================= */ 
    case 0x5C:                
        if (A==0){             //Para Menu Principal
        t--;
        if (t==0) t=5;
        if (t==5){
             //MenuPrinc2();           //Reubica las opciones
             LCD_SendChar(188);
             Pausa_10mS();
           
        }else{
              MenuPrinc();
              LCD_SendChar(128+(t-1)*20);
              Pausa_10mS();
             
             
             }
        }
        else if(A==1){      //Estoy en el reloj: Horas
                A--;
                if (A==0) A=5;
                if (A==5){
                }
        }

    break;
 /*===========================  Fin Flecha_Arriba ============================= */    
 /*======================================================================*/
 /**                                                                                                                                                             **/
 /**                                                         A  LOT OF CODE                                                                        **/
 /*===================================================================== **/
  
while(!(PTD_PTD6&PTD_PTD5&PTD_PTD4&PTD_PTD3)){    //Check if the key  is still down
    err=LCD_SendBlock("No solte tecla",14,&SND);
    Pausa_100mS();
   }                                                                        //La tecla no fue soltada y no hace nada hasta que se suelte
 
 Pausa_10mS(); //espero rebotes al soltar   (debounce delay)
 Fila2_ClrVal();               
 Fila1_ClrVal();
 tecla=FALSE;
 KBSCR_ACK=1;              //Coloco nuevamente KEYF en 0
 KBSCR_IMASK=0;   //Habilito nuevamente las interrupciones de teclado
        }
  }
 
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;:smileywink:{}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/


Best Regards
Pablo


Message Edited by NLFSJ on 2007-07-02 11:26 AM

Outcomes