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

PROBLEM WITH GPIO INTERRUPT i.e. port on change interrupt

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



Joined: 06 Mar 2007
Posts: 92
Location: Pune,India

View user's profile Send private message AIM Address Yahoo Messenger

PROBLEM WITH GPIO INTERRUPT i.e. port on change interrupt
PostPosted: Fri Mar 09, 2007 12:05 am     Reply with quote

Dear sir,
here i am getting error while compling this code.i am sensing pulses at GPIO0,GPIO1 pin as an interrupt. if pulse come at GPIO0,O/P high,and if pulse at GPIO1,O/P LOW.
But i am getting error at #INT_RA0 & #INT_RA1 line.these interrupt are defined in 12f629.h file. still error.
for this i am using pic12f629,MPLAB V7.5 & CCS PCM C Compiler, Version 3.249, 34534.
Plz refer below source code,

Thanking You,
Regards,
Deepak.

*****************SOURCE CODE************

#include<12f629.h>

#fuses INTRC,NOWDT,PUT,NOMCLR,NOBROWNOUT,NOPROTECT
#use delay(clock = 4000000)
#define GPIO0 PIN_A0
#define GPIO1 PIN_A1

#BYTE OSCCAL = 0X90
#BYTE WPU = 0X95
#BYTE INTCON = 0X8B
//#BYTE IOC =0X96
void init_CPU();

void main()
{
init_CPU();


while(1)
{


}

}

void init_CPU()
{

WPU = 0B00001011;
//IOC = 0B00000011;
INTCON = 0B11001000;
SET_TRIS_A(0B00000011);
SETUP_COMPARATOR(NC_NC_NC_NC);

ENABLE_INTERRUPTS(INT_RA0);
ENABLE_INTERRUPTS(INT_RA1);

#asm
call 0x3ff
movlw OSCCAL
#endasm

}

*********/// ERROR IN THE FOLLOWING LINE ///**************

#INT_RA0
PORT0_ISR()
{
OUTPUT_HIGH(GPIO0);
CLEAR_INTERRUPT(INT_RA0);
}

#INT_RA1
PORT1_ISR()
{
OUTPUT_LOW(GPIO1);
CLEAR_INTERRUPT(INT_RA1);
}

*******/// END OF PROGRAME ///***************************
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 09, 2007 2:02 am     Reply with quote

Quote:
But I am getting error at #INT_RA0 & #INT_RA1 line.
These interrupt are defined in 12f629.h file. Still error.

See these posts:
http://www.ccsinfo.com/forum/viewtopic.php?t=23272
http://www.ccsinfo.com/forum/viewtopic.php?t=28547

-------------
Quote:
#asm
call 0x3ff
movlw OSCCAL
#endasm

This isn't going to work. Movlw loads the W register with the constant
value in the operand. In the code above, it loads W with 0x90.

It should be:

Code:
movwf OSCCAL
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