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 in 18f4431 not work

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



Joined: 09 Sep 2006
Posts: 8

View user's profile Send private message

Interrupt in 18f4431 not work
PostPosted: Sat Sep 09, 2006 9:14 am     Reply with quote

I use 18f4431 and interrupt not work. I already initial interrupt function

enable_interrupts(GLOBAL); //enable global interrupts
enable_interrupts(INT_RDA); //enable Serial Interrupts

and I already make Serial Interrupt function.

#INT_RDA
RDA_isr(){

}
But it not work, please advice me

katesuda
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 12:10 pm     Reply with quote

Here is a very simple test program for #int_rda on an 18F4431.
I tested this with PCH vs. 3.249 on a PicDem2-Plus board. It works.
When you type a character, it will get sent to the PIC, and the PIC
will send back the next higher character. If you type 'A', you will
get 'B', etc. This is done in case you have "local echo" enabled
on your terminal program, and you didn't know it. If you type 'A'
and then get 'B', then you know the program and your hardware
are working correctly.
Code:

#include <18F4431.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000) 
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#int_rda
void rda_isr(void)
{
char c;

c = getc();
putc(c + 1);   

}   

//======================================

void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);

while(1);
}
kkatesuda



Joined: 09 Sep 2006
Posts: 8

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 8:11 pm     Reply with quote

Thank you for PCM programmer after I burn use your code to my PIC Chip. Interrupt not work again. I don't know why.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 10:35 pm     Reply with quote

Here is a version that doesn't use interrupts. Try it.
Code:
#include <18F4431.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000) 
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

//===================================
void main()
{
int8 c;

printf("Start: ");   

while(1)
  {
   c = getc();
   putc(c +1);
  }

}

If this code doesn't work, then check your hardware.
kkatesuda



Joined: 09 Sep 2006
Posts: 8

View user's profile Send private message

PostPosted: Sat Sep 09, 2006 11:46 pm     Reply with quote

Very Thank for PCM programmer

I found the problem it from 18f4431 it not receive any information. I not have any debugger, very thank for your helpful. Now I use other cpu for temperary 18f4550 it work.

Katesuda
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