View previous topic :: View next topic |
Author |
Message |
vin883
Joined: 27 Jun 2007 Posts: 2
|
GETS problem when changing XTAL frequency |
Posted: Wed Jun 27, 2007 8:49 am |
|
|
Hello,
I'm using a PIC16F876 to achieve a RS232 communication via gets with a PC. Everything was working right with a 4 Mhz xtal at a 9600 baud rate.
(#use delay(clock=4000000))
I have to use now a 19.66 Mhz xtal but my serial bus does not work anymore. (baud rate unchanged , #use delay(clock=19660800))
I don't see what would cause this problem... |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Jun 27, 2007 9:50 am |
|
|
Can you verify the actual clock speed? If you don't have a counter or a scope make the PIC toggle a LED at 1/minute rate and check it with a wristwatch. This will tell you if you have an oscillator problem. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
vin883
Joined: 27 Jun 2007 Posts: 2
|
|
Posted: Wed Jun 27, 2007 10:10 am |
|
|
I verified the clock speed on the scope, it is correct. Actually, everything is working except the USART functions (GETS, getc...) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jun 27, 2007 10:24 am |
|
|
Post a small test program that shows the problem. Make sure you post
all of your #include, #fuses, and #use statements.
Also post your compiler version. It's a 4-digit number such as 3.249
or 4.032, and you can find it at the start of the .LST file, which will be
in your project directory. Don't post any numbers that come after the
version number. |
|
|
Eugeneo
Joined: 30 Aug 2005 Posts: 155 Location: Calgary, AB
|
|
Posted: Mon Jul 02, 2007 3:09 am |
|
|
Are you getting garbage out of the port?
Is it a 20 mhz part? |
|
|
Guest
|
|
Posted: Mon Jul 02, 2007 7:14 am |
|
|
Hello all,
The problem came from an update of the SPBRG register in my code I forgot to refresh according to the 19.66 Mhz clock.
Thanks anyway |
|
|
|