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

PIC18f8722 UART not Functional

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



Joined: 22 Feb 2012
Posts: 2

View user's profile Send private message

PIC18f8722 UART not Functional
PostPosted: Wed Feb 22, 2012 9:25 am     Reply with quote

Code:

#include "C:\Users\SASH\Desktop\MASTER_THESIS\CCS\blah.h"
#fuses NOPUT,NOLVP, NOWRT, WDT512,NOPROTECT,NODEBUG,MCLR,HS,FCMEN,IESO

//#use delay(clock=10000000, crystal=10000000)
#use delay(clock=10000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,PARITY=N,BITS =8,UART1,STOP=1,STREAM=PC,ERRORS)

void main()
{
   setup_adc_ports(AN0|VSS_VDD);
   setup_adc(ADC_CLOCK_INTERNAL|ADC_TAD_MUL_0);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_uart(9600);
 
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_4(T4_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   printf("DEBUGPORT not working");
}


Hello all,
I am trying to implement a simple Debug port here. I have attached the code above.

I always miss the last 2 bytes on the PC terminal program.

If I send DEBUGPORT not working.
I receive DEBUGPORT not worki NULL.
What am I doing wrong? Any help is appreciated...
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Feb 22, 2012 9:29 am     Reply with quote

You would always miss the last two bytes.
You are letting the code drop off the end, which sends it to sleep. The hardware buffer still has two characters to send, so these are lost....

Best Wishes
technochrat



Joined: 22 Feb 2012
Posts: 2

View user's profile Send private message

PostPosted: Wed Feb 22, 2012 9:44 am     Reply with quote

So what would be the corrective measure ?
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Wed Feb 22, 2012 10:17 am     Reply with quote

Add a while(1) loop at the end of main().

Nearly all PIC programs need such a loop. In most, of course, its where the main processing takes place, over and over and over...

RF Developer
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