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

I have some bug on "RDA interrupt"

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



Joined: 05 Aug 2009
Posts: 37

View user's profile Send private message MSN Messenger

I have some bug on "RDA interrupt"
PostPosted: Thu Aug 26, 2010 9:06 pm     Reply with quote

I have a bug on "PIC24FJ256GA106"

When I open two "int_RDA" that PIC will work normal.
But if I open third "int_RDA" (int_RDA, int_RDA2, int_RDA3) that PIC will not work.

Who can help me to solve this bug ?? I'm very thanks Very Happy

Here is my code of .h file & .c file
Code:

#include <24FJ256GA106.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOJTAG                   //JTAG disabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES ICSP1                    //ICD uses PGC1/PGD1 pins
#FUSES WINDIS                   //Watch Dog Timer in non-Window mode
#FUSES WPRES128                 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS16                 //Watch Dog Timer PostScalar 1:32768
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES PR                       //Primary Oscillator
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES NOOSCIO                  //OSC2 is clock output
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES IOL1WAY                  //Allows only one reconfiguration of peripheral pins
#FUSES WPEND_LOW             
#FUSES NOWPCFG               
#FUSES NOWPDIS               
#FUSES WPFP                 
#FUSES RESERVED                 //Used to set the reserved FUSE bits

#use delay(clock=24000000)

#pin_select U1TX = PIN_G6        //coma
#pin_select U1RX = PIN_G7
#pin_select U2TX = PIN_B14       //comb
#pin_select U2RX = PIN_B15
#pin_select U3TX = PIN_D8       //comc
#pin_select U3RX = PIN_D9

#use rs232(UART1,baud=9600,parity=N,bits=9,LONG_DATA,stream=coma)
#use rs232(UART2,baud=115200,parity=N,bits=8,stream=comb)
#use rs232(UART3,baud=115200,parity=N,bits=8,stream=comc)




Code:

//------------------------------------------------------------------------------

#int_RDA
void  RDA_isr()
{
   rs_buff[buff_number] = getc(coma);
   if(buff_number<32)
   {
      buff_number=buff_number+1;
   }
   else
   {
      buff_number=0;
   }
}
//------------------------------------------------------------------------------
#int_RDA2
void  RDA2_isr()
{   
   //TestP = getc(comb);
   //fprintf(comb,"%c",TestP);   
   
   rs_buffb[buff_numberb] = getc(comb);
   if(buff_numberb<128)
   {
      buff_numberb=buff_numberb+1;
   }
   else
   {
      buff_numberb=0;
   }   
}
//------------------------------------------------------------------------------
#int_RDA3
void  RDA3_isr()
{     
   //TestP = getc(comb);
   //fprintf(comb,"%c",TestP);
   
   rs_buffc[buff_numberc] = getc(comc);
   if(buff_numberc<64)
   {
      buff_numberc=buff_numberc+1;
   }
   else
   {
      buff_numberc=0;
   }
}
//------------------------------------------------------------------------------
void main()
{
   delay_ms(200);
   setup_spi(FALSE);
   setup_spi2(FALSE);
   setup_wdt(WDT_ON);
   setup_timer1(TMR_DISABLED|TMR_DIV_BY_1);   
   enable_interrupts(INT_RDA);
   enable_interrupts(INT_RDA2);   
   enable_interrupts(INT_RDA3);
 
   for(;;)
   {
        my code XXXXXX
        ...
        ...
   }
}

ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Aug 27, 2010 1:14 am     Reply with quote

How do you know UART3 is not working?

To rule out hardware problems. What happens when you shuffle the pins around so that UART 2 and 3 are switched? Does UART 2 then stop working?

PIC24 is new for CCS, so you might have stumbled upon a bug.
Always post your compiler version number. It might be a known (and fixed) problem.

Extra advice: study the ex_sisr.c example code for how you could implement an interrupt driven receiver routine using a circular buffer. This has proven to be one of the better methods for serial data reception.
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