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

RS-232 missing characters

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







RS-232 missing characters
PostPosted: Sun Apr 20, 2003 8:07 pm     Reply with quote

Anyone know why I always miss the last two characters off string printed to any terminal program??

Am using very minimal program to printf across rs-232. When i use the internal SCI Pins C6 and C7 the last two characters don't print. Works OK when i use Pins_A0 & A1 or when I put a while loop after the printf eg.
while(TRUE)
putc( getc()+1);

Am reasonably new to C and PICs - probably something I haven't spotted.


#include <16F877.h>
#fuses hs,nowdt,noprotect,noput,nowrt,nolvp,nobrownout
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

main() {
printf("\r\nRead or Write: ");
printf("start");
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 13849
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: RS-232 missing characters
PostPosted: Sun Apr 20, 2003 8:54 pm     Reply with quote

:=Anyone know why I always miss the last two characters off string printed to any terminal program??
----------------------------------------------------

<a href="http://www.pic-c.com/forum/general/posts/12268.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/12268.html</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13850
Dave Yeatman
Guest







Re: RS-232 missing characters
PostPosted: Sun Apr 20, 2003 8:54 pm     Reply with quote

The CCS compiler automatically puts a Sleep statement at the end of your code and the program is getting there before the USART has a chance to send the data. Add the following to the end of your main block and it should fix your problem:

while (TRUE) {}

Dave


:=Anyone know why I always miss the last two characters off string printed to any terminal program??
:=
:=Am using very minimal program to printf across rs-232. When i use the internal SCI Pins C6 and C7 the last two characters don't print. Works OK when i use Pins_A0 & A1 or when I put a while loop after the printf eg.
:= while(TRUE)
:= putc( getc()+1);
:=
:=Am reasonably new to C and PICs - probably something I haven't spotted.
:=
:=
:=#include <16F877.h>
:=#fuses hs,nowdt,noprotect,noput,nowrt,nolvp,nobrownout
:=#use delay(clock=4000000)
:=#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
:=
:=main() {
:= printf("\r\nRead or Write: ");
:= printf("start");
:= }
___________________________
This message was ported from CCS's old forum
Original Post ID: 13851
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