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

EXT INT ON PIC18F1230

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







EXT INT ON PIC18F1230
PostPosted: Mon Oct 08, 2007 8:28 am     Reply with quote

Hi,

i want to create an external Interupt on PIN A0 (INT0). My Problem is that the PIC doesn´t jump to the ISR.also wdt is off!!
Have anyone this Problem befor?

Thanks for your help!

Thorsten

Here is my code:

#include "main.h"


#int_EXT
void EXT_isr(void)
{
output_high(PIN_B0);
delay_us(10);
output_low(PIN_B0);
}


void main()
{
set_tris_a(0x01); set_tris_b(0xdc);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_adc(ADC_CLOCK_INTERNAL|ADC_TAD_MUL_0);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
ext_int_edge( H_TO_L );

enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);


while(TRUE)
{
}
}


Here my Header file

#include <18F1230.h>
#device adc=8

#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES H4 //High speed osc with HW enabled 4X PLL
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES PUT //Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOXINST //Extended set extension and Indexed Addressing mode enabled
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOWRTC //configuration not registers write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOCPB //No Boot Block code protection
#FUSES NOWRTB //Boot block not write protected
#FUSES BBSIZ512 //Boot block size 512 bytes
#FUSES FLTAA5 //FLTA multiplexed on A5
#FUSES T1OSCA6 //T1 oscillator pin on A6
#FUSES NOPWMPIN //PWM outputs disabled upon Reset
#FUSES HPOL_HIGH //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
//PWM module high side output pins have active high output polarity
#FUSES LPOL_HIGH //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
//PWM module low side output pins have active high output polar

#use delay(clock=40000000)
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Mon Oct 08, 2007 8:39 am     Reply with quote

Add a NOLVP fuse (if you're not low voltage programming.)

I'm not sure, but before your main loop, you may want to read the PIN_A0 to ensure that it is configured as an input?
Ttelmah
Guest







PostPosted: Mon Oct 08, 2007 8:43 am     Reply with quote

A0, is not the EXT interrupt.
The EXT interrupt, is on _B0_, which you are using as an output...
You need to rethink your pins used.

Best Wishes
Thorsten
Guest







PostPosted: Mon Oct 08, 2007 9:56 am     Reply with quote

At the PIC18F1230 the PIN-A0 is the INT0 Interupt input.
Ttelmah
Guest







PostPosted: Mon Oct 08, 2007 10:29 am     Reply with quote

Sorry, confused 1230, with 1320...

I'd suspect your problem is with the ADC configuration. You cannot have multiple setup_adc lines. Only the last one will apply if you do this, and your last one, does not turn off the ADC.
Just use:

setup_adc(ADC_OFF);

Best Wishes
Thorsten
Guest







PostPosted: Tue Oct 09, 2007 12:40 am     Reply with quote

That was a good hint but it doesn`t work. If i change to PIN-B3 (INT3) it work ´s fine. I also think that i have a problem with the PORTA settings, but i can´t find my problem.
Thorsten
Guest







PostPosted: Tue Oct 09, 2007 12:57 am     Reply with quote

Hi, my problem is solved. CCS Compiler don´t setup the ADCON1 Register correct. Bit 0 have to be 1, for digital Input.

Thanks for your help
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