Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
I respectfully disagree with the claim that C is overkill for pic programming . For some applications such as motion control, writing the code in assembly is a plain pain. Just look at application note AN532 from Microchip titled "Servo control of DC Brush Motor", the code listing is over 100 pages long which I find to be quite difficult to debug and maintain. Many of you are no doubt very good at assembley, so I guess this is not really an issue that will bother you. However, for slackers like me writing code in C certainly save time and keeps my sanity .
By the way, I find that the HT-PICC compiler sometimes generates more efficient code (with optimization on of course) than what I can write .
some words from a dinosaur
I wrote assembly code for 8080, Z80, 8051, HPC and PIC and I thought I did it well
nevertheless, 10 years ago I had a course in programming µC in C
there was alot of headache before the first program worked
but through the years I discovered the great benefits of C
today I write programs for PIC, 8051 and M16C in C (even PIC12C508)
if nessessary assembly code is included, but overall < 2%
at this point I could start a list of advantages and disadvantages, but believe me, C is great !
I started programming micros directly in assembly where there were not compilers available. But later I started to use the following method, that reveled to be very efficient for me:
I start to code my program in C, compile it and perform tests. The result can be very slow and memory consuming, but this allows me to verfy the correctness of the algorithms an helps to identify the critical parts (those than are worth to be optimized). I can run and debug the program at reduced speed.
If necessary, I optimise those parts coding them in assembly (hand compiling). I preserve the original C code as comments. This step is frequently unavoidable in real-time applications.
As a result, the program is easy to mantain and modify. And is you want to migrate to another micro or DSP, you don’t have to start from zero.
Even in the case I don’t have a C compiler, I found very important to code it in C and compile at hand. Thinking the algorithms in high-level language is very helpful, and use state diagrams for finite-state machines (not flow diagrams).