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

18F4580 - Can't run #INT_EXT

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








18F4580 - Can't run #INT_EXT
PostPosted: Fri Aug 14, 2009 3:24 am     Reply with quote

Hi all,

This simple program doesn't run. I'd make too many test but I can't see what I'm doing wrong. PIN_B3 is toggling, but no interrupt is generated.

Thanx in advance,

Code:
#include <18F4580.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

#int_ext
void int_ext_isr(void)
{
   output_toggle (PIN_B1);
}   

void main()
{
   ext_int_edge(H_TO_L);
   enable_interrupts (int_ext);
   enable_interrupts (global);
   port_b_pullups(TRUE);
     
   while(TRUE)
   {
      output_toggle (PIN_B3);
      delay_ms (250);
   }
}
kansusid



Joined: 12 Jun 2006
Posts: 9
Location: INDIA

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 3:45 am     Reply with quote

how do you generate H-L transition?
_________________
kansusid
Guest








PostPosted: Fri Aug 14, 2009 3:55 am     Reply with quote

Hi,

I'm using PICDEM 2 PLUS board. At PIN_B0 there's 2.4 VDC. There is a pull-up resistor with a pushbutton, also a current limiter resistor from pushbutton to PIN_B0.

Regards
Ttelmah
Guest







PostPosted: Fri Aug 14, 2009 4:15 am     Reply with quote

Pin B0, when used as an interrupt, has a Schmitt input buffer. Vih, is 0.8*Vdd. So 2.4v, will oly be seen as 'high', if your supply voltage is 3v or lower.....
Since the standard 4580, has a minimum supply voltage of 4.2v, your input will never be seen as 'high', so there will be no high to low transition....

Best Wishes
Guest








PostPosted: Fri Aug 14, 2009 4:41 am     Reply with quote

Ttelmah,

it's totally correct. I'd checked it shot-circuiting PIN_RB0 to VCC to generate a L-H trigger and pushing on the pushbutton RB0 to re-arm L condition, and it works as you said. So the problem is the circuit provided with PICDEM 2 PLUS Demo Board.

Thanx in advance for your speedy help.

Regards.
Ttelmah
Guest







PostPosted: Fri Aug 14, 2009 8:34 am     Reply with quote

As a comment though, it was because you posted exactly the right way. Simple code, showing the problem, and included the voltage when asked. Made accurate diagnosis possible. :-)

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 11:43 am     Reply with quote

On the PicDem2-Plus (both versions), pins B0-B3 are used for LEDs.
Pin B0 is also used a pushbutton switch. The LEDs hold down the voltage
on those pins. Pull out Jumper J6 to remove the LEDs from the circuit.
This should fix your problem.
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