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

Interrupt on pin change with PIC16F684

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



Joined: 17 Oct 2005
Posts: 98

View user's profile Send private message

Interrupt on pin change with PIC16F684
PostPosted: Wed Jun 28, 2006 2:57 am     Reply with quote

Hello forum,

I know this question has been asked many times, and I have read many post about it, but I can't make it work.

I have a simple test app:
I'm trying to light a LED when a pin goes high. I'm using PIN_A4 for the interrupt input pin, with a pull-down resistor of 22k. Then I have connected a LED to PIN_C2 and another LED to PIN_C3.

The LED on PIN_C3 (and the code in the main while loop) is only for me to make sure the PIC is running.

Code:
.h file:

#include <16F684.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES
#use delay(clock=8000000)


.c file:

#include "684-test-pin-int.h"

#int_RA
RA_isr()
{
   int8 i;
   output_high(PIN_C2); // Set PIN_C2 high
   i = input(PIN_A4); // Make sure to read the interrupt pin
}

void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC);
   setup_vref(FALSE);
   enable_interrupts(INT_RA4);
   enable_interrupts(GLOBAL);
   setup_oscillator(OSC_8MHZ);

   set_tris_a(0b00010000); // Make PIN_A4 an input

   output_low(PIN_C2); // Make sure pin is low

   while(1)
   {
      // Blink LED on PIN_C3 to see the PIC is running
      output_high(PIN_C3);
      delay_ms(500);
      output_low(PIN_C3);
      delay_ms(500);
   }
}


I connect PIN_A4 to Vdd to pull it high to activate the interrupt. But nothing happens.

Any suggestions?

I have been looking at the function ext_int_edge() to see if I could make the PIC interrupt on either a rising edge or a falling edge, but since I can't make it interrupt at all, I'm waiting a bit with this. Any comments on ext_int_edge() is also welcome.

Edit: I forgot to mention that I use version 3.249 of the CCS compiler.
Futterama



Joined: 17 Oct 2005
Posts: 98

View user's profile Send private message

PostPosted: Wed Jun 28, 2006 3:45 am     Reply with quote

I found the solution... MY GOD!

All the fuses my old version of CCS made for me, is now gone. So, I was missing the INTRC_IO fuse because I made a new project with my new version of CCS, and the field "Fuses" ind the "General" tab is empty. So I suppose I had PIN_A4 configured as CLKOUT or something.

But where did the fuses go?

And where is the explanation of each fuse?
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