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

[SOLVED thanks]#INT_RDA executed once !

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



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

[SOLVED thanks]#INT_RDA executed once !
PostPosted: Wed Jan 27, 2010 11:39 pm     Reply with quote

Dear programmers,

I'm working on a big project with the dspic30f4013.

I've ran into an issue with the serial interrupt. It only fire once !

I've simplified the whole project to this simple test code.


Code:

#include <30f4013.h>
#FUSES FRC_PLL16,PR_PLL,NOWDT,NOPUT,NOMCLR,NOBROWNOUT

#use delay(clock=117920000)
#use rs232(baud=9600, UART1A, ERRORS)



#INT_RDA
void analyzepacket_isr(){
int8 inputchar;
inputchar = getc();
output_high(PIN_D3);
}

void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(INTR_GLOBAL);
while(true){
delay_ms(200);
output_low(PIN_D3);
}
}


The led only goes high and then 200 ms after turns off never go high again and data still flowing to the pins !

I've tried to clear the interrupt still nothing but i know the pic is still _running_ (it catch my buttons press [not shown in this code])

I've read somewhere that i need to call getc (read the data) to clear the interrupt i don't know if its true but just in case i've left the getc part.

EDIT: tried with output_toggle same thing ! :(

EDIT2: PCWHD 4.104

Any ideas?

Thanks!
_________________
Regards,
Laurent

-----------
Here's my first visual theme for the CCS C Compiler. Enjoy!


Last edited by ELCouz on Thu Jan 28, 2010 12:48 am; edited 1 time in total
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Thu Jan 28, 2010 12:32 am     Reply with quote

The interrupt is cleared by the interrupt routine (you don't see it, but invoking #int_xxx installs the CCS interrupt handler (provided you don't specify #int_global)).

The receive-buffer-full flag is cleared by doing the getc();

Consider adding "stream=comm" or some-such to your #use RS232 statement and then calling fgetc(comm); to narrow the program to get from that channel.

Also, UART1A? is that right or a typo?

So you have a scope? Consider toggling a pin high and then low inside your ISR to make sure it keeps firing after every RS232 char.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
ELCouz



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

PostPosted: Thu Jan 28, 2010 12:45 am     Reply with quote

I've copied this line from a example of CCS from EX_SISR.c (because i know this would works its an official example Smile )

Code:

#elif defined(__PCD__)
#include <30F2010.h>
#fuses HS, NOWDT, NOPROTECT
#use delay(clock=20000000)
#use rs232(baud=9600, UART1A)
#endif


after further investigation i've found this somewhere in the forum

Quote:
// UART1A specifies the alternate UART pins Pin_C13, Pin_C14
// use UART1 to sprcify UART for pins Pin_F3, Pin_F2



I'm on F3 and F2 pins

Now i've tried with UART1 and it work jeez i feel very sorry to not check this before posting !!!


Thank you ! Smile
_________________
Regards,
Laurent

-----------
Here's my first visual theme for the CCS C Compiler. Enjoy!
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