![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
russr
Joined: 24 May 2005 Posts: 8 Location: New Jersey
|
Soft RS-232 baud rate 115200 not being generated correctly?? |
Posted: Thu Feb 16, 2006 4:28 pm |
|
|
I am using a PIC16F876 with 20mhz oscillator. For several years I've used PCW v3.045 and the following code has worked w/o problems:
#include <16f876.h>
#fuses HS,NOWDT,NOPUT,NOBROWNOUT, NOLVP, NODEBUG
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
#use delay (clock=20000000) //20mhz
// PortB OUT
#bit TXD = 6.4
// PortB IN
#bit RXD = 6.5
#use rs232(baud=115200, xmit=PIN_B4,rcv=PIN_B5)
void main() {
setup_adc_ports(NO_ANALOGS);
set_tris_a(0); //all out
set_tris_b(0xE1); // 1110 0001
set_tris_c(0xFB); // 1111 1011
printf("Initilization was successful!\r\n");
while (true)
printf("test\r\n");
}
We recently upgraded to PCWH v3.224 and the above code does not work correctly...specifically, nothing is getting printed out to the hyperterminal screen. If I lower the baud rate to 9600 and recompile, it works like I'd expect. As mentioned above, the same code with baud=115200 compiled on v3.045 works. I'm using a MAX3380E leveler/inverter chip. I've tried upgrading to v3.225, but same problem.
Any ideas? I suspect that the baud clock is not being generated correctly with this new compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 16, 2006 4:42 pm |
|
|
Quote: | We recently upgraded to PCWH v3.224 |
My records show that PCM vs. 3.224 came out on approximately
April 26, 2005. Vs. 3.225 came out on about May 27, 2005. |
|
![](templates/subSilver/images/spacer.gif) |
russr
Joined: 24 May 2005 Posts: 8 Location: New Jersey
|
|
Posted: Thu Feb 16, 2006 4:48 pm |
|
|
PCM programmer wrote: | Quote: | We recently upgraded to PCWH v3.224 |
My records show that PCM vs. 3.224 came out on approximately
April 26, 2005. Vs. 3.225 came out on about May 27, 2005. |
You r correct, we purchased it back in May, but didn't get around to actually testing out this feature until recently. Anyway, I'm not really sure what this has to do with the problem I posted. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 16, 2006 5:30 pm |
|
|
I just wanted everything to be accurate.
Anyway, I tested vs. 3.224, and the baud rate is incorrect. I was able
to make it work by changing the "baud" parameter in the #use rs232
statement to 109000. With a 20 MHz crystal, this generates a baud
rate of 115482 for a soft UART. This is only about 1% off, so it works
OK. I tested both transmit and receive with Hyperterminal.
Example:
Quote: | #include <16F877.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=20000000)
#use rs232(baud=109000, xmit=PIN_C6, rcv=PIN_C7, FORCE_SW)
void main()
{
char c;
printf("Start\n\r");
while(1)
{
putc(0x55); // Used to measure Tx baud rate
// c = getc();
// printf("%c", c);
}
}
|
|
|
![](templates/subSilver/images/spacer.gif) |
russr
Joined: 24 May 2005 Posts: 8 Location: New Jersey
|
|
Posted: Fri Feb 17, 2006 8:20 am |
|
|
Thanks PCMProgrammer!
So how come this is not listed as a feature that was corrected in later versions on the changes page here: http://www.ccsinfo.com/versions.shtml ?
Do you know what version this was corrected in, if any at all? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Fri Feb 17, 2006 10:12 am |
|
|
russr wrote: | Thanks PCMProgrammer!
So how come this is not listed as a feature that was corrected in later versions on the changes page here: http://www.ccsinfo.com/versions.shtml ?
Do you know what version this was corrected in, if any at all? |
Unfortunately, the list is about as comprehensive, as a three page telephone directory of the US...
For any single entry on the list, there are typically probably half a dozen other changes, and some (usually ones that perhaps only affect one processor, and were only themselves 'introduced' a version or two ago), never get mentioned.
There were posts here some time ago, about incorrect soft serial baud rates, and these then stopped, so it is presumably fixed. A quick test on a couple of rates for me, seems to give values that are OK, on the current versions.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
russr
Joined: 24 May 2005 Posts: 8 Location: New Jersey
|
|
Posted: Fri Feb 17, 2006 10:16 am |
|
|
I emailed their tech support and sent them my .LST file. I think they were able to confirm the problem as they are emailing me the latest version of the compiler.
I only hope the latest version does not introduce additional bugs. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|