PORTb interruption (CCS compiler)

Status
Not open for further replies.

Van der Waals

Member level 2
Joined
Mar 11, 2008
Messages
45
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,580
int_rb ccs

Hello all,

My code which consists on lightening a LED connected to RA3 with a push-button connected to RB6 was compiled with success (0 error , 2 warnings of conditions always true and false) but did no function when I tried to simulate it with ISIS however it was a simple one (see below),

would anybody help me in correcting it or give me another correct code written with the same compiler ?


thanks in advance.


I use PCW 4.057 version of CCS.

Code:
#include "C:\Documents and Settings\test 1.h"
  #ZERO_RAM


#define RB6 PIN_B6  

int1 flag6;

#int_RB            
void RB_isr()          
{
if (!RB6) flag6=1;   
delay_ms(300);
}                 


void main()
{

   port_b_pullups(TRUE);
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_spi(FALSE);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_8);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);



   ext_int_edge(H_TO_L); 
   enable_interrupts(INT_EXT);
   enable_interrupts(INT_RB); 
   enable_interrupts(GLOBAL);
   
   set_tris_b(0xff);         
   set_tris_a(0x00);        
   

 flag6=0;
 
while(1)

  {

  if (flag6)
     {
     output_high(pin_a3);
     flag6=0; 
     }
 
  }

   

}
 

ccs portb

first you have not specified your device.
Are u using External Interrupt or RB Port Status Change interrupt.
 

portb ccs

hi Saeed_pk,

saeed_pk said:
first you have not specified your device.
My PIC is a 16F876,

saeed_pk said:
Are u using External Interrupt or RB Port Status Change interrupt.

if you don't mind, what's the difference between them ?

now only one interruption comes from RB6 and is generated by a push-button, (just to test the code) but then I'll have to manage at least 3 other interruptions inputs in the other pins.

I read that with the CCS compiler there is two different ISR (Interrupt Service Routine) depending on PortB pins:


RB0:

Code:
#INT_EXT
void ext_isr()
{

}



RB4,RB5,RB6,RB7:

Code:
#int_RB           
void RB_isr()          
{

}
 
Reactions: Kazz78

    Kazz78

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…