|
|
View previous topic :: View next topic |
Author |
Message |
Forest Guest
|
RS-232 missing characters |
Posted: Sun Apr 20, 2003 8:07 pm |
|
|
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
|
Re: RS-232 missing characters |
Posted: Sun Apr 20, 2003 8:54 pm |
|
|
:=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 |
Posted: Sun Apr 20, 2003 8:54 pm |
|
|
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 |
|
|
|
|
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
|