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

PIC12F629 Baudrate Problem

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



Joined: 19 Mar 2010
Posts: 18

View user's profile Send private message

PIC12F629 Baudrate Problem
PostPosted: Fri Mar 19, 2010 9:01 am     Reply with quote

I am using PCWHD ver 4.084. I compiled the program and tested it. But I am getting some scrambled characters only at the pc terminal program. I am getting the hex value is:
Quote:

00 20 00 00 00 00 00 00 80 80 00

This is my code:
Code:

#include <12F629.h>
#fuses NOWDT, HS, NOPROTECT, NOMCLR, PUT, NOBROWNOUT
#use delay(clock=16000000)
#use rs232(baud=115200, parity=N, xmit=PIN_A2, rcv=PIN_A3, bits=8)

void main()
{

 while (1) {
    printf ("Hello, world.\r\n"); // print to serial port
    delay_ms(500);               // do nothing for half a second
 }
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19518

View user's profile Send private message

PostPosted: Fri Mar 19, 2010 11:02 am     Reply with quote

First, test that your crystal really is working OK at 16MHz.
Do a simple 'pin on for half second, pin off for half second' type test, and check that you do get 1Hz.
The chip is OK at 16MHz, provided you are using >4.5v supply, but does get slightly fussy about crystals.
Then, describe your serial hardware. What buffer chip are you using?. How long is the wiring (max cable length at 115200, is not that great....).

Best Wishes
chandra



Joined: 19 Mar 2010
Posts: 18

View user's profile Send private message

PostPosted: Sat Mar 20, 2010 2:41 am     Reply with quote

It is working. The problem is the Buffer chhip Max232. Now I need to work it without Max 232 chip. How can do the code modify.
Thanks.
chandra



Joined: 19 Mar 2010
Posts: 18

View user's profile Send private message

PostPosted: Sat Mar 20, 2010 10:24 am     Reply with quote

Code:

#use rs232(baud=115200, parity=N, xmit=PIN_A2, rcv=PIN_A3, INVERT)
 

By this it is working fine.
Thanks for all.
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