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 CCS Technical Support

Pic18f458 serial rate problem

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



Joined: 15 Jan 2004
Posts: 10

View user's profile Send private message

Pic18f458 serial rate problem
PostPosted: Mon Jan 19, 2004 3:32 am     Reply with quote

Does anyone know if I can run a PIC18F458 with a 20Mhz ocs at 115200 baud rate?
When I printf a sting I get lost characters when viewed with hyperterminal.
Pete Smith



Joined: 17 Sep 2003
Posts: 55
Location: Chester, UK

View user's profile Send private message Visit poster's website MSN Messenger ICQ Number

Re: Pic18f458 serial rate problem
PostPosted: Mon Jan 19, 2004 4:03 am     Reply with quote

SB wrote:
Does anyone know if I can run a PIC18F458 with a 20Mhz ocs at 115200 baud rate?
When I printf a sting I get lost characters when viewed with hyperterminal.


That could be a Hyperterminal problem. I use Teraterm instead (Google for it - I've lost the URL).

FWIW, to get a zero error on the baud rate, choose a baud rate that's a multiple of 2 of your baud rate.

For 115200 baud at ~20MHz, I'd suggest 18.432MHz. (160x the desired rate).

HTH

Pete.
SB



Joined: 15 Jan 2004
Posts: 10

View user's profile Send private message

PostPosted: Mon Jan 19, 2004 5:06 am     Reply with quote

Thanks for your suggestion but I get the same result using Teraterm so thats not it.
Also I don't have any problems with other baud rates which have greater error percentages.
Ttelmah
Guest







Re: Pic18f458 serial rate problem
PostPosted: Mon Jan 19, 2004 5:48 am     Reply with quote

SB wrote:
Does anyone know if I can run a PIC18F458 with a 20Mhz ocs at 115200 baud rate?
When I printf a sting I get lost characters when viewed with hyperterminal.

'Lost characters'?. Obviously, if there was an error in baud rate, you would expect 'garbaged' characters, rather than 'lost' characters. If the characters are completely 'lost', then there are two possibilities. The first is that the PIC is not sending them, while the second is that the PC is failing to receive them. There is no reason for the former (provided everything is the same and working at lower rates), since though the output dats rate rises, most of the register timings, will be slightly easier (for transmit), at the higher rate. Again if there was a signalling problem, you would expect that there would be a tendency to corrupted characters, rather than complete loss.
Before blaming the PIC, try putting a DVM, or scope on the PC's 'handshake' lines, and enabling hardware handshaking in the UART settings box. Also make sure you have the FIFO's enabled here. You may well find that the PC is the problem, and you may need to implement hardware handshaking in both directions (assuming you are going to want the PIC to receive a response). Unfortunately, the latency time of PC's to interrupts is very poor indeed. If you are sending a reasonably long stream of characters, even quite powerful machines can end up losing characters. This is why fast UART cards for the PC, have hardware buffers of often 256 or more characters.
I have suffered in the past, from being able to receive data continuously, at 500000bps, with a really old Z80 based microcontroller, but the same data losing 20 or 30% of characters, when reception was tried on a PC, with a clock that is nominally over 100* faster!...

Best Wishes
SB



Joined: 15 Jan 2004
Posts: 10

View user's profile Send private message

PostPosted: Mon Jan 19, 2004 6:09 am     Reply with quote

Sorry I did mean to say 'garbaged' characters.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Jan 19, 2004 6:56 am     Reply with quote

Are you using a serial cable or something that you made? Are you using the hardware UART on the pic?
SB



Joined: 15 Jan 2004
Posts: 10

View user's profile Send private message

PostPosted: Mon Jan 19, 2004 7:28 am     Reply with quote

I am using a bought serial cable and using..
#use rs232(baud=115200, xmit=PIN_C6, rcv=PIN_C7)
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Mon Jan 19, 2004 7:30 am     Reply with quote

Are you using an RS232 transceiver chip?
SB



Joined: 15 Jan 2004
Posts: 10

View user's profile Send private message

PostPosted: Mon Jan 19, 2004 7:49 am     Reply with quote

Yes we are using a MAX232. We use this same design on another board using a 18F452 which works great at 115200 baud.
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