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

Problem with serial communication

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







Problem with serial communication
PostPosted: Mon May 12, 2003 10:39 am     Reply with quote

I'm using CCS PCW compiler to generate code for serial communication for the PIC16F84.



#include "usart84.h"
#include


void main() {
char c;
// int8 i;
setup_counters(RTCC_INTERNAL,WDT_18MS);

printf("Hello ");
printf("Press a key: ");
c=getc();
printf("You've pressed: \%c",c);
}



The file "usart84.h" is as follows:

#include <16F84.h>
#use delay(clock=4000000)
#fuses XT,PUT,WDT
#use rs232(baud=9600,parity=N,xmit=PIN_A3,rcv=PIN_A2,bits=8)


The problem is :
The output is several time the word "Hello Press a" & some strange characters...
My question is :
How the computer & the PIC insure the synchronization???
Why the PIC is not reading the character? by getc()????
10x for ur responses.
___________________________
This message was ported from CCS's old forum
Original Post ID: 14378
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: Problem with serial communication
PostPosted: Mon May 12, 2003 10:54 am     Reply with quote

<font face="Courier New" size=-1>Try doing these two things:

1. Remove the Watchdog timer from your program.

2. Put a while(1); statement as the last statement in main().
</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 14379
zico
Guest







Re: Problem with serial communication
PostPosted: Tue May 13, 2003 4:35 am     Reply with quote

Hello.
10x a lot PCM programmer, you are absolutely right.
I simply deactivated the WDT, & that's it.
It's not looping.
Bravo.
___________________________
This message was ported from CCS's old forum
Original Post ID: 14398
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