View previous topic :: View next topic |
Author |
Message |
zico Guest
|
Problem with serial communication |
Posted: Mon May 12, 2003 10:39 am |
|
|
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
|
Re: Problem with serial communication |
Posted: Mon May 12, 2003 10:54 am |
|
|
<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 |
Posted: Tue May 13, 2003 4:35 am |
|
|
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 |
|
|
|