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

My UART setting can't receive data !! 24FJGB106

 
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

My UART setting can't receive data !! 24FJGB106
PostPosted: Thu Apr 29, 2010 3:33 am     Reply with quote

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)

FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Apr 29, 2010 6:43 am     Reply with quote

Both use rs232 statement don't have a reference to a hardware UART, so they will create software UARTs. Consult
the manual, you need to add UART1 and UART2 keywords.
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