CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PortB interrupts and definition of edge

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rfjhh



Joined: 31 Mar 2011
Posts: 51
Location: Mexico

View user's profile Send private message

PortB interrupts and definition of edge
PostPosted: Tue Feb 23, 2016 9:56 am     Reply with quote

I'm doing a program using port B interrupts (PIC16F887). If enable_interrupts use (INT_RB4 | H_TO_L); I have no problems, the bits of the corresponding IOCB register are established and the interrupt is enabled. However, if use L_TO_H, the corresponding bits in the IOCB are not set and the interrupt is not enabled.

The code is as follows:
Code:

void main()
{
   int8 i = 0,dum;
   set_tris_a(0xff);
      set_tris_b(0xf0);
      setup_oscillator(OSC_8MHZ);
   lcd_init();
   setup_adc(ADC_CLOCK_INTERNAL);
   SETUP_ADC_PORTS(sAN0);
   /*Habilito interrupciones en PuertoB para entrada de teclado*/
   enable_interrupts(GLOBAL);                // INTCON<7:6>
   enable_interrupts(INT_RB4 | L_TO_H);      // INTCON<3>, IOCB<4>
   enable_interrupts(INT_RB5 | L_TO_H);      // INTCON<3>, IOCB<5>
        enable_interrupts(INT_RB6 | L_TO_H);      // INTCON<3>, IOCB<6>
        enable_interrupts(INT_RB7 | L_TO_H);      // INTCON<3>, IOCB<7>
        enable_interrupts(GLOBAL);                // INTCON<7:6>
   
   
    for(;;)
    {
       dum = 0;
       if(i==3)
       i = 0;
       else
       i++;
       output_b(fila[i]);
       lcd_gotoxy(1,1);
       printf(lcd_putc, "%2Lu", t_data);
    }
}

What's going on? What can I do?

I am looking forward to your response.

Cheers

Ricardo Hernandez
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Tue Feb 23, 2016 10:01 am     Reply with quote

INT_RB does not work like this.

H_TO_L, is for INT_EXT _only_. Look at the data sheet. Look at the include file.
Quote:

// Constants used in EXT_INT_EDGE() are:
#define L_TO_H 0x40
#define H_TO_L 0


INT_RB, is an interrupt on _change_. All changes. No direction control on this chip.
rfjhh



Joined: 31 Mar 2011
Posts: 51
Location: Mexico

View user's profile Send private message

PostPosted: Tue Feb 23, 2016 12:57 pm     Reply with quote

Thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group