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 support@ccsinfo.com

Unable to make "int_ext" on Embedded Ethernet Kit

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



Joined: 06 May 2010
Posts: 33

View user's profile Send private message

Unable to make "int_ext" on Embedded Ethernet Kit
PostPosted: Fri Feb 07, 2014 7:43 am     Reply with quote

Hi,
I'm trying to make int_ext work on Embedded Ethernet Kit. I try to turn on a LED placed in PIN A5 when I push the button in Pin A4 but it never gets into the interruption routine. Pin a4 is connected to RB0 to treat the interruption.
The PIC is 18F4620 and clock =40MHz.

I can`t see anything wrong with the code
Code:

int tone = 0;           //activated tone 1 or deactivated 0
int ctl = 0;            // control flag

#int_EXT
void  EXT_isr(void)
{
   if (tone == 0){
     ctl = 1;
     output_toggle(GREEN_LED);
   }else{
      output_toggle(GREEN_LED);
      tone = 0 ;
   }
   
delay_ms(DELAY);    //200ms
}

void main()
{
   ext_int_edge(H_TO_L);
   enable_interrupts(INT_EXT);
   enable_interrupts(GLOBAL);
    //Example blinking LED program
   
    while(true){
      if (ctl == 1){
     //  puts("Envio tonos");
       ctl = 0;
       tone = 1;
      }
    }

}

I tried it using EXT1 but still having the same problem.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Feb 07, 2014 1:52 pm     Reply with quote

Look at the schematic. Pins B0 and B1 are used for external circuits.
They are driven by 74HCT08 drivers. You can't use those pins.
Check the schematic carefully to see if pin B2 is free. I didn't check it.

For the future, the most important things to check if a pin doesn't work are:
1. External circuit connections that already exist on your board.
2. Multiple configurations in the PIC for that pin for different peripherals.
Make sure the pin isn't enabled for the UART, CCP pwm, etc.
3. Limitations of the pin. Some pins are "input only". The can't do output.
4. Your TRIS settings in your code may have disabled the pin as an
input. The pins default to be an input.
5. Requirements for a pullup resistor for the pin to be able to switch high
and low as an output pin. This mostly is for older PICs such as 16F877
on pin A4.
Manel28



Joined: 06 May 2010
Posts: 33

View user's profile Send private message

PostPosted: Mon Feb 10, 2014 7:33 am     Reply with quote

Thanks for the info. Int_ext2 works perfectly
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