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

C18 vs CCS

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



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

C18 vs CCS
PostPosted: Thu Jan 28, 2021 7:09 am     Reply with quote

OK, I was curious about C18 and found this as their 'getting started' example #1...
Code:

#pragma config OSC=IRCIO, ...  //set configuration bits

int someGlobalInteger;         //define global variables
char someGlobalCharacter;
...

int someSubFunction(int someInput){  //define functions
   ...
   ...
   ...
   return someValue;
}
...

void main( void ){          //Code entry point
   OSCCON = 0b11111111;     //Configure oscillator, if needed
   TRISA  = 0b11110000;     //Configure ports as input or output
   TRISB  = 0b00000000;     //Configure unused ports as output to prevent floating inputs
   ANSEL0 = 0b00000000;     //Set input ports as analog or digital inputs
   ANSEL1 = 0b00000000;
   LATA   = 0b00000000;     //Set initial conditions for output ports
   LATB   = 0b11111111;
   ...                      //Configure other peripherals like PWM, QEI, interrupts, etc.

   while(1){                //Main program loop.  PIC will execute loop until reset.
      ...
      ...                   //Put code here.



Ok, silly question, What Speed is the clock ??

Sorry, can't get the code into 'green' mode.
Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Jan 28, 2021 7:40 am     Reply with quote

You can't tell.

They are using INT RC, so you would need to read the data sheet and
find out what clock rate is selected for the internal oscillator, when OSCON
is set to all 1's.
So it depends on the chip, and it's settings.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 28, 2021 8:40 am     Reply with quote

Hmm. magically the code got 'green' !

Yeesh, something so basic (and necesary) is hidden !
Makes me a 'happy camper' that I chose CCS, way back when.....

jay
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 28, 2021 2:44 pm     Reply with quote

You gotta click the "code" tag above the text box when you type your post to get the code "green".

Yeah, I'm pretty happy with CCS too. I work with a software engineer who was a little annoyed at some aspects of CCS, until we tried a new chip and all it took was changing a couple of fuses and the whole framework he programmed before just plopped right on.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 28, 2021 7:53 pm     Reply with quote

re: a little annoyed at some aspects of CCS
gee, I have to ask, what was annoying ?

I'm NOT a 'C' programmer, lousy typist but everything I cut code for works..eventually, usually under 50 revisions...usually.
Self taught to use/abuse C from CCS examples, this forum and some reading.

Jay
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Thu Jan 28, 2021 8:03 pm     Reply with quote

He came from a world of programming on computers so he thought the whole including .c files was weird, plus a few other little things. There was something else he wanted to do that used recursion but in the end I think he found a way around it.

But in the end CCS feels like a tight product, and does it's job well. With this porting code to a new chip thing that I was talking about, really shows the power of this. No need to spend time setting up the hardware because it's all taken care of by the compiler. That way we can focus on application code.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Jan 29, 2021 12:55 am     Reply with quote

It didn't 'magically' get green. I added the code tags. Smile

Must admit I rather like the story about the programmer. It really shows
'why' CCS users tend to stick with it.... Very Happy

The other big plus, is the speed with which they do fix issues.
Generally, new chips in particular, will have problems for the first few
releases. Also, just occasionally, CCS make changes, perhaps to improve
optimisations, and these can introduce new 'multi chip' problems (we have
seen this recently). However once these are sorted, 90% of the compiler
releases work well. However it is impressive when you have an issue, and
within a few hours, they come back with a fix.
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Fri Jan 29, 2021 1:07 am     Reply with quote

Yes, I also want to add that they are almost always unusually responsive and responses usually indicate action, unlike customer service response from most companies.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Tue Feb 02, 2021 5:52 am     Reply with quote

I have C18, C30 and C32, XC8, XC16 and XC32.

C18 isn't bad - but it's harder to use and it's a dead product.

XC8/16/32 are the replacements and when I first upgraded, my first XC8 project was riddled with problems.

See -- Microchip wanted to give away the compiler for free. So instead of limiting compilation by lines, they limited optimization which, if the project is large enough, forces the "free" users to buy bigger ROM PICs.

There were 3 levels of optimization. There was Free, and then 2 more in the paid version. Standard and Pro (or something like that)

What was the differences?

Free inserted a lot of NOPs and other garbage. Like. Literally. You'd look at types of code like loops or indirect memory references and they were constructed poorly.

Standard would get rid of the NOPs and slightly optimize the garbage code.

Pro mode would start using the special instructions in the PIC and really make the code tight. -- Like as tight as CCS out of the box.

Here's where the problem kicked in.

One problem I ran into was an ISR where free mode made the ISR just trash with lots of NOPs and what. But it worked.

Standard mode -- would take out the NOPs, but also had horrid code optimization.

Pro mode looked great! Except they'd forget instructions needed for an ISR (IIRC, the return-from-interrupt was missing from the assembly!!)

Basically, the compiler had to keep track of the trash insertion/deletion and optimization differences between optimization modes.

When I had this problem, I would print out/save the differences between the modes and literally point to the missing instruction to Microchip tech support who ran me around for weeks because I was a consultant and not an end client. I finally had to complain to a friend of mine who worked there and how it was jeopardizing the project with a client that normally bought reels and reels of microchip parts.

He got me to the head of software dev and we finally fixed the problem, but it took WEEKS of arguing with some tier 1 support grunt who couldn't spell ASM.

When I have a problem with CCS?

When I call CCS with questions or problems. Who usually picks up the phone most of the time? Mark. The owner. When I have legit problems, they get solved FAST. It's lightspeed compared to Microchip.

I will only compile with Microchip compilers if I have to. Honestly, the old Cxx series were a lot less problem-prone than the XC series. But neither series are easy to sit down and just go.

After 20+ years of using CCS, it's still my go-to compiler for most PIC projects.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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