-------------------------------------------------- From: "Olin Lathrop" Sent: Wednesday, August 11, 2010 3:29 PM To: "Microcontroller discussion list - Public." Subject: Re: [PIC] 18F45K20 newbie help > Wouter van Ooijen wrote: >>> I have used C18 and I agree with the quality of code it produces. >> >> C18 is IMHO one of the worst C implementations I have ever seen in >> terms of code density and quality of the PIC libraries provided with >> it. > > You're right, I should have qualified that more. What I meant by=20 > "quality" > was that the code seems to work. In other words, the machine code does=20 > what > the high level source code defines. However, I did not mean to say the=20 > code > is well optimized or particularly clever. > > As for quality of the libraries, I wouldn't know since I have never > deliberately used any library routines. Peripheral use is different=20 > enough > from one project to another that no reasonable runtime configuration can > exist. Providing them is only a illusion for the incompetent, not of any > real use in real projects. > > The UART is one exception to this. It is possible to have largely canned > UART handling code that can be used accross projects with little > modification. However, even with this you rarely need runtime setup > choices. For example, the baud rate for most projects is fixed as define= d > in the protocol spec. Passing it as a runtime parameter is silly, since= =20 > the > machine then has to do a bunch of calculations, and drag in the associate= d > math routines, to determine the baud rate setup. This is best done at=20 > build > time on the host, with the baud rate setup being constants at run time. > > My UART_BAUD macro, for example, does this computation at build time give= n > the desired baud rate and the instruction clock frequency. Yes, C18 has problems but is still one of the better offerings IMHO. The=20 main reason I picked C18 and Hi-Tech was they are both pretty solid and=20 quite well documented, with lots of examples available on the web etc. I=20 believe being easy to get started with and the availability of plenty of=20 support is important for someone just getting into C, and the code=20 size/speed etc is unlikely to be a problem at this point. However if pushed= =20 to choose between the two on that front I would probably go for Hi-Tech, as= =20 it produces smaller/faster code and it *looks* like it may be=20 supported/around longer than C18. =20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .