sindyme
Joined: 05 Aug 2009 Posts: 37
|
My UART setting can't receive data !! 24FJGB106 |
Posted: Thu Apr 29, 2010 3:33 am |
|
|
CCS Ver : PCD 4.017
PIC : PIC24FJ256GB106
My UART setting can't receive data !!
There is my code ~
I want to use "#pin_select" to setting PIC24FJ256GB106 PR pin
But It can't receiver any data.
The RDA_interrupt no work ~ How can I solve it ?
Please help me ~ thanks vary much Orz.
My #pin_select at H.file
PS : The xmit can work. It can send data to hyperterminal.
Code: |
#int_RDA
RDA_isr()
{
Temp = getc(coma);
fprintf(coma,"%c",Temp);
// for testing
}
//-------------------------------------------------------------------
#int_RDA2
RDA2_isr()
{
Temp = getc(comb);
fprintf(comb,"%c",Temp);
// for testing
}
void main()
{
setup_spi( FALSE );
setup_spi2( FALSE );
setup_wdt(WDT_OFF);
setup_adc_ports(NO_ANALOGS);
setup_timer1(TMR_DISABLED|TMR_DIV_BY_1);
enable_interrupts(INT_RDA);
enable_interrupts(INT_RDA2);
enable_interrupts(INTR_GLOBAL);
for(;;)
{
//for testing
delay_ms(500);
fprintf(coma,"comb test work\r\n");
fprintf(comb,"comb test work\r\n");
}
}
|
And my H.file
Code: |
#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 ICSP2 //ICD uses PGC2/PGD2 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 PLL1 //No PLL PreScaler
#FUSES DISUVREG
#use delay(clock=24000000)
#pin_select U1TX=PIN_G6
#pin_select U1RX=PIN_G7
#use rs232(baud=115200,parity=N,bits=8,stream=coma)
#pin_select U2TX=PIN_B14
#pin_select U2RX=PIN_B15
#use rs232(baud=115200,parity=N,bits=8,stream=comb)
|
|
|