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

#int_rda does not fire in dsPIC30f6014a

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



Joined: 19 May 2011
Posts: 3

View user's profile Send private message

#int_rda does not fire in dsPIC30f6014a
PostPosted: Thu May 19, 2011 11:44 pm     Reply with quote

The code below without the ISR works fine
Code:

#include<30f6014a.h>
#device adc=10
#fuses XT_PLL8, PRPLL
#use delay(clock=80M,oscillator=10M)
#use rs232(baud=115200,parity=N,xmit=PIN_F3,rcv=PIN_F2,bits=8)
#include<lcd.h>

unsigned char input[10];

void main(void){
  while(1) {
     input[0] = getc();
     putc(input[0]);
  }
}

But when I include the #int_rda, the service routine does not work. A similar code works fine with 16f877a chip.
The modified code is
Code:

#int_rda
void serial_interrupt(){
  input[0] = getc();
}

void main(void) {
 enable_interrupts(INT_RDA);
 enable_interrupts(INTR_GLOBAL);
 while(1) {
   putc(input[0]);
 }
}

The char is sent but not received. Many thanks for the help.

Dr suhail
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Fri May 20, 2011 2:40 am     Reply with quote

I think you need to look at #pin select. On this chip the UART is re-mappable to two sets of pins. The compiler needs to be told that you want to use the UART on the primary pins.

Best Wishes
suhail



Joined: 19 May 2011
Posts: 3

View user's profile Send private message

PostPosted: Thu May 26, 2011 10:54 pm     Reply with quote

Many thanks for the reply. I think you are right. I tried the following commands
Code:

#pin_select U1Tx=PIN_F3
#pin_select U1Rx=PIN_F2

by compiler version is 4.065

The error that was generated was

error 7:... Invalid pre-processor directive Invalid pin

I think the version does not support pin_select directive. Is there a way around ?
regards
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Fri May 27, 2011 2:26 am     Reply with quote

What compiler version are you on?.
I just tried a fractionally modified code, on 4.118, and the RDA interrupt fires OK.
Code:

#use rs232(baud=115200,parity=N,UART1,bits=8)

unsigned char input[10];
int1 have_char=FALSE;

#int_rda
void serial_interrupt(){
  input[0] = getc();
  have_char=TRUE;
}

void main(void) {
 enable_interrupts(INT_RDA);
 enable_interrupts(INTR_GLOBAL);
 do {
   if (have_char) {
      have_char=FALSE;
      putc(input[0]);
   }
 } while(TRUE);
}


Best Wishes
suhail



Joined: 19 May 2011
Posts: 3

View user's profile Send private message

PostPosted: Sun May 29, 2011 5:56 am     Reply with quote

many thanks for the reply and effort.
my ver is 4.065
i think i did try UART1 option... but not sure...
will try it next week and let you know..
many thanks and regards
Ttelmah



Joined: 11 Mar 2010
Posts: 19520

View user's profile Send private message

PostPosted: Sun May 29, 2011 9:37 am     Reply with quote

I suspect the version may be the problem. 4.065, is 'borderline' on when V4, started to work reasonably completely, and there were a few threads at the time about problems with the DsPic's, and getting their UART's to work. In some cases using the UART1 option did help, but not for all...
I haven't got a PCD, back this far, but 4.099, is not handling the interrupts the same way as the later compilers, suggesting problems may well be present here.

Best Wishes
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