View previous topic :: View next topic |
Author |
Message |
Guest
|
18F4580 - Can't run #INT_EXT |
Posted: Fri Aug 14, 2009 3:24 am |
|
|
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
|
|
Posted: Fri Aug 14, 2009 3:45 am |
|
|
how do you generate H-L transition? _________________ kansusid |
|
|
Guest
|
|
Posted: Fri Aug 14, 2009 3:55 am |
|
|
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
|
|
Posted: Fri Aug 14, 2009 4:15 am |
|
|
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
|
|
Posted: Fri Aug 14, 2009 4:41 am |
|
|
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
|
|
Posted: Fri Aug 14, 2009 8:34 am |
|
|
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
|
|
Posted: Fri Aug 14, 2009 11:43 am |
|
|
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. |
|
|
|