HC908AP32 - Why Buzzer on, while IRSCI INterrupt_Tx?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HC908AP32 - Why Buzzer on, while IRSCI INterrupt_Tx?

1,764 Views
B_Conf
Contributor I
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
Labels (1)
0 Kudos
3 Replies

378 Views
admin
Specialist II
:smileywink: Hello friend.s ,
 
I am going to ask in Spanish ,OK:
 
Tengo una pregunta , el modulo IRSCI , lo estas forzando por interrupcion?
 
Es que tengo una duda , estoy manejando un AP16, y estoy tratando de leer un control remoto SONY  y no eh podido lograrlo , me gustaria una ayuda de como configuraste el modulo
 
Gracias.
 
 
//---------------------------------------------------------------------------------------
I am going to ask in English :
 
I have a question, I modulate IRSCI, these forcing by interruption?
 
She is that I have a doubt, I am handling a AP16, and I am trying to read a remote control SONY and not eh been able to obtain it, gustaria me an aid of as you formed I modulate
 
Thanks.
0 Kudos

378 Views
B_Conf
Contributor I
Bogotario,
            I´m using IRSCI with interrupts, I configure it by CW, and I´m using only the SCI of it. So I can`t tell you so much of how you have to configure this part.
You should check if the IR SCI is enable and if it is necesary for your application, and the duty cycle of the pulses.

Best regards

Bogotario:
               Estoy transmitiendo datos de forma asincrónica a un LCD y solo estoy utilizando la IRSCI como SCI, ya que tengo reservada para otra cosa la SCI.
Te sugeriría que revises la configuración de la IRSCI, aunque supongo que ya lo has hecho.
Lamentablemente no puedo darte una solución con respecto a este tema.
Saludos.

Pablo
0 Kudos

378 Views
B_Conf
Contributor I
Hello,
  Just in case, anybody else have a similar problem, I fix it by setting  PTA5 as an input while send a message to LCD, then when I need "Beeps" I set PTA5 as an output.

Regards
0 Kudos