Continue to Site

Welcome to

Welcome to our site! 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.

looking for a program c for pic

Not open for further replies.


Member level 1
Dec 19, 2002
Reaction score
Trophy points
Activity points
hand compiling zx80

need program c for pic

pic ccs finite state machine model

Please look at the following discussion. You'll find all about c programming for PIC

**broken link removed**

C for Pic?

Why would you use c for pic? Pic language is very easy. It's compact and logic. If you use a language like C its like taking an airplane to visit your neighbours.

I myself had to yearn Pic and I got the hang of it within a day or two.

CCS Compiler is good. Lots of functions with it.

Hitech good also !

The many fonctions of CCS are not very usefull if you must frequently, like me, jump from Pic to 51, AVR or HC908.

If you want to stick on Pic CCS is OK !

Quasi Ansi C (like Hitech, Keil, Icc, Codewarrior...) give good portability from
one chip to another.


If you want portable code use hitech picc. If you want functions to easily use, use picbasic!

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 :D .

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 :oops: .


By my opinion, if you are using 12bit PIC's (like popular 16C5X) you should use assembler, for 14bit and more - C is OK.


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 !

Use C and/or assembly for micros and DSPs

Hi friends,

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).

I hope this point of view can help.


neriusb said:
By my opinion, if you are using 12bit PIC's (like popular 16C5X) you should use assembler, for 14bit and more - C is OK.


why we should use assembler for 12-bit PICs?

Not open for further replies.

Part and Inventory Search

Welcome to