View previous topic :: View next topic |
Author |
Message |
leong
Joined: 28 Sep 2005 Posts: 5
|
? 16F687 UART baudrate not correct |
Posted: Wed Sep 28, 2005 11:14 pm |
|
|
?any one gets a hint on this:
I programed the pic16f687 uart function as
#use rs232(baud=9600, xmit=PIN_B7,rcv=PIN_B5)
then i check the oscilloscope, data was sent but at a much higher speed than 9600 bps should be. I'm using the internal 8mhz clock and it looked fine when i put the fosc/4 on the scope.
I noticed there is an errata listed under datasheet page for this chip on microchip's website.. but i have no idea if that's relavent? _________________ wooohooo... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 28, 2005 11:26 pm |
|
|
Post a small test program that demonstrates the problem.
Make sure that the program you post has been tested with
your oscilloscope. If possible, send 0x55 in while(1) loop,
by using putc(). This will give a signal that you can easily
sync on with your scope. Measure the bit time and post it.
It would be best if you copied and pasted the test program
directly from MPLAB into your post, with no editing.
Also post the version of your compiler. This will be a number
such as 3.191, or 3.235, etc. |
|
|
leong
Joined: 28 Sep 2005 Posts: 5
|
|
Posted: Thu Oct 06, 2005 7:20 pm |
|
|
Thanks,
that problem got solved mysteriously.. I had two folders with different names but same project name in them. when i tried to load project from one place, some how the workspace is still the old one... When I made modifications in header file, it mixed up...
that problem disapeared after I reorganized the test folder and reopened the project.. this time it's 9600 khz per bit exact..
thank you for the hint.
PCM programmer wrote: | Post a small test program that demonstrates the problem.
Make sure that the program you post has been tested with
your oscilloscope. If possible, send 0x55 in while(1) loop,
by using putc(). This will give a signal that you can easily
sync on with your scope. Measure the bit time and post it.
It would be best if you copied and pasted the test program
directly from MPLAB into your post, with no editing.
Also post the version of your compiler. This will be a number
such as 3.191, or 3.235, etc. |
_________________ wooohooo... |
|
|
|