| View previous topic :: View next topic |
| Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 10, 2012 2:56 pm |
|
|
| Quote: | I'm facing a strange issue of the s/w RS232 implementation.
I run PIC16F1939 @ 4MHz, and I'm trying to use s/w serial running @ 38400.
|
The bit period for 38400 is 26.04 usec, so that should easily be possible
for the compiler to do. What's your CCS compiler version ? It's given
at the top of the .LST file (look in your project directory for that file).
Version numbers look like this:
http://www.ccsinfo.com/devices.php?page=versioninfo |
|
 |
slavka012
Joined: 10 Feb 2012 Posts: 28
|
|
Posted: Fri Feb 10, 2012 4:04 pm |
|
|
| temtronic wrote: | | Internal oscillators aren't all that stable(1%) which can account for the frequency being off. |
Thanks for stating the obvious. Like I said, I confirmed correct frequency of the chip. Actual frequency is within 1% of the 4MHz.
You can also notice that resulting baud rate differs by 7%.
As another poster noted, 38400 is easy for compiler to achieve with better than 1% accuracy with the given CPU speed. In fact it worked on different projects/chips.
I believe I have the latest compiler:
CCS PCM C Compiler, Version 4.129, 59140 |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9658 Location: Greensville,Ontario
|
|
Posted: Sat Feb 11, 2012 7:16 am |
|
|
| If you have previous compilers, maybe try the same code and look at the listings where the software UART is created. Perhaps CCS made a change to code for some reason and the UART code has been altered. 7% is a 'huge' difference but heck 1 or 2 instructions in a loop....... ! |
|
 |
|