sindyme
Joined: 05 Aug 2009 Posts: 37
|
I have some bug on "RDA interrupt" |
Posted: Thu Aug 26, 2010 9:06 pm |
|
|
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
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
...
...
}
}
|
|
|