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 support@ccsinfo.com

UART BRGH10K error

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



Joined: 19 Aug 2012
Posts: 19

View user's profile Send private message

UART BRGH10K error
PostPosted: Wed Jul 17, 2013 1:28 pm     Reply with quote

Hi!

I want to implement a DMX transmitter and receiver, but I can't use a baud rate of 250k because of when I compile I get the error "BRGH10K out of range" while it has been generated by the Wizard.

I use a PIC18F46K22 @24 MHz (external CMOS/TTL oscillator)

I use the version v4.141 but I tried in the demo of v5 and still the same problem...

Hope you'll be able to help me.

Thank's!

PS : I didn't write anything else, I just compiled what was generated by the Wizard...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 17, 2013 1:58 pm     Reply with quote

The problem is not the UART speed. The problem is a spelling error.
You have "BRGH10K", where you have "10K" on the end, like a resistor.
But it's supposed to be BRGH1, with "OK" on the end, like the American
slang for "good" or "it's allowed".

With corrected spelling, this program compiles with no errors (with vs. 4.141):
Code:
#include <18F46K22.h>
#fuses ECH_IO, NOWDT
#use delay(clock=24M)
#use rs232(baud=250000, UART1, ERRORS, BRGH1OK)

//======================================
void main(void)
{
char c;

c=getc();
putc(c);

while(1);
}
g-netix



Joined: 19 Aug 2012
Posts: 19

View user's profile Send private message

PostPosted: Thu Jul 18, 2013 10:47 am     Reply with quote

Ok thank you it works! I don't understand why it doesn't work when it's generated by the Wizard, but I renamed it as you said and it works fine.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Jul 18, 2013 4:10 pm     Reply with quote

perhaps your version of the Wizard
"kent spill viry will" Very Happy Very Happy Very Happy
Ttelmah



Joined: 11 Mar 2010
Posts: 19385

View user's profile Send private message

PostPosted: Fri Jul 19, 2013 4:20 am     Reply with quote

You will find that few of the relatively 'experienced' people here ever use the Wizard. It has quite a few bugs....

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Jul 19, 2013 7:21 am     Reply with quote

It is a bug that went long time unnoticed because the BRGH1OK parameter is only added for the higher baud rates. At 24MHz clock and 115k2 baud the BRGH1 register isn't used and the erroneous parameter isn't added.

As I got the impression nobody reported the bug to CCS I sent them an email.
Scottzilla



Joined: 17 Jul 2012
Posts: 14

View user's profile Send private message

PostPosted: Sat May 27, 2017 2:43 pm     Reply with quote

4 years later and the wizard still spells BRGH1OK wrong!
Ttelmah



Joined: 11 Mar 2010
Posts: 19385

View user's profile Send private message

PostPosted: Sat May 27, 2017 2:48 pm     Reply with quote

and the same answer still applies.

To use the Wizard, you have to know every setting for the chip. If you know the settings, it is better to set them yourself. Result, nobody actually doing anything beyond very initial learning, actually uses the Wizard. There are several dozen faults that the Wizard routinely generates. Honestly the compiler would be better without the Wizard....
Ttelmah



Joined: 11 Mar 2010
Posts: 19385

View user's profile Send private message

PostPosted: Sun May 28, 2017 8:21 am     Reply with quote

As a separate comment to this though, it is really silly that we still have the BRGH1OK setting.

Historically, on the earliest PIC's when CCS first started, this was one of the first major errata. Since there were almost no others, they made the compiler default to not setting the BRGH bit, and added this option for the chips where it was OK. Now though we have literally hundreds of errata affecting many chips. Instead of allowing a setting like this, these are now stored as part of the chip data with fixes automatically being applied. Surely it'd make more sense now to get rid of this setting (leave it as an option for 'reverse compatibility'), but have the compiler default to supporting BRGH being set to '1' unless the chip has this stored as an erratum. Especially since now there are perhaps 100 PIC's without this problem for every one with....
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