18F45K22 - external interruption

1

A led flashing every half a second, while the other will only be accessed when I send a low level signal to RB0 in the microcontroller, I wanted to know if something is missing, since I did exactly as they asked me and even then, only the polling led is blinking, the interrupt does not occur: here is the code in C:

bit  controle;
void interrupt()      
{
  if(INT0IF_bit)
  {
    controle = ~controle;
    INT0IF_bit = 0;
    if(controle) RA0_bit = 1;
    else RA0_bit = 0;
  }
}

void main()
{
  TRISA = 0xFC; 
  TRISB = 0xFF; 
  PORTA = 0xFC;
  PORTB = 0xFF;
  IPEN_bit = 1; 
  RBIP_bit = 1;
  INTCON = 0x90; 
  INTCON2 = 0x00;
  controle = 0;

  while(1)
  {    
    //  Lógica para fazer LEd piscar por Polling..
    RA1_bit = 0x01;
    delay_ms(TempoPolling);
    RA1_bit = 0x00;
    delay_ms(TempoPolling);
    // Fim da Lógica
}
    
asked by anonymous 30.09.2016 / 03:09

0 answers