View previous topic :: View next topic |
Author |
Message |
chandra
Joined: 19 Mar 2010 Posts: 18
|
PIC12F629 Baudrate Problem |
Posted: Fri Mar 19, 2010 9:01 am |
|
|
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: 19569
|
|
Posted: Fri Mar 19, 2010 11:02 am |
|
|
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
|
|
Posted: Sat Mar 20, 2010 2:41 am |
|
|
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
|
|
Posted: Sat Mar 20, 2010 10:24 am |
|
|
Code: |
#use rs232(baud=115200, parity=N, xmit=PIN_A2, rcv=PIN_A3, INVERT)
|
By this it is working fine.
Thanks for all. |
|
|
|