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

GETS problem when changing XTAL frequency

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



Joined: 27 Jun 2007
Posts: 2

View user's profile Send private message

GETS problem when changing XTAL frequency
PostPosted: Wed Jun 27, 2007 8:49 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jun 27, 2007 9:50 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jun 27, 2007 10:10 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jun 27, 2007 10:24 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 02, 2007 3:09 am     Reply with quote

Are you getting garbage out of the port?
Is it a 20 mhz part?
Guest








PostPosted: Mon Jul 02, 2007 7:14 am     Reply with quote

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 Wink
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