Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

What is a Compiler?

Status
Not open for further replies.

Suraj143

Active Member
Hi all I need some information’s regarding “C”

To program in C what are the requirements?

Theirs something called compilers what are those? They are so many compilers. Why not use only one compiler?

In MPLAB MPASM is built in to assemble the ASM code. But are their any compilers built in to compile C code in MPLAB?
 
Ok now what I understood is a compiler means "It is a program that translate source code to an object code (output code)"

My question is why there is so many compilers? Why not use only one compiler?
 
Why isn't everyone using PICkit 2? Why are there so many programming software / programmer out there? Why are there so many electronics forums?
Get what I mean? :)

*EDIT: Ohh.. Nigel is faster :D
 
Hi very funny :D

When doing in assembly language we didn't find any assemblers.MPLAB comes with MPASM & all did with it.

But when it comes to "C" many people asking what compiler using?

Thats what I mean.
 
Suraj143 said:
Hi very funny :D

When doing in assembly language we didn't find any assemblers.MPLAB comes with MPASM & all did with it.

But when it comes to "C" many people asking what compiler using?

Thats what I mean.

hi suraj,
IIRC, MPLAB also have a free 'C' compiler and its well supported with libraries etc.
 
A car of course you can drive it to a place.But the final output is the place that you go.

It means can I use any compiler to compile a C code?

Then what about other computer software engineers? They also writing computer port drivers in C can we use their compilers also?
 
Last edited:
Last edited:
Suraj143 said:
A car of course you can drive it to a place.But the final output is the place that you go.

It means can I use any compiler to compile a C code?

Then what about other computer software engineers? They also writing computer port drivers in C can we use their compilers also?

You need to use a compiler that produces machine code for the processor in question.

Also MPASM isn't the only assembler for PIC's (it should be - why produce a different one?), Parallax did one years ago using a strange kind of 'macro' language, and TASM is a shareware assembler that can assemble PIC code (but the source needs to be different).
 
Nigel Goodwin said:
You need to use a compiler that produces machine code for the processor in question.

Also MPASM isn't the only assembler for PIC's (it should be - why produce a different one?), Parallax did one years ago using a strange kind of 'macro' language, and TASM is a shareware assembler that can assemble PIC code (but the source needs to be different).

Oh I see then the Microchip decided to include the best assembler to their MPLAB that is MPASM.

Likewise C compilers also easy easy inserting to the MPLAB ex:HitecC,CCS etc...
 
FWIW :)
The compilers we to generate code for our micro controllers are know as cross compilers.

Wikipedia:
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is run.
 
3v0 said:
FWIW :)
The compilers we to generate code for our micro controllers are know as cross compilers.

Wikipedia:
A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is run.

This is the point.It means does HITECH PICC-Lite & CCS are cross compilers?Then what about C18?

Then the language will be the same "C" it will change some few options.

Now I slightly understood.A computer software engineer cannot use our compilers because they are dedicated to us.Its supported to our needs to work along with MPLAB.

To program their stuff they need some other compilers.

Sorry for extending the questions part.
 
Last edited:
Suraj143 said:
This is the point.It means does HITECH PICC-Lite & CCS are cross compilers?Then what about C18?

Then the language will be the same "C"

Sorry for extending the questions part.

The platform is the hardware/CPU/(instruction set).

All the compilers you mention run on the PC (a platform) and generate code for the PIC uC (a different platform). That makes them cross compilers.

An example of a compiler that is NOT a cross compiler is Microsoft Visual Studio C++. It runs on the PC and generates code for the PC. Both the same platform.
 
Really being a cross compiler makes no difference, it doesn't make a compiler any simpler because it runs on the same processor it's generating code for.

Obviously where things do get easier is debugging, because the code is running in the same machine as the debugger and compiler.

Any compiler for a PIC has to be a cross compiler, as there's no space in a PIC to run a compiler, nor any suitable interface/OS to run it under.
 
3v0 said:
The platform is the hardware/CPU/(instruction set).

All the compilers you mention run on the PC (a platform) and generate code for the PIC uC (a different platform). That makes them cross compilers.

An example of a compiler that is NOT a cross compiler is Microsoft Visual Studio C++. It runs on the PC and generates code for the PC. Both the same platform.

Hi 3V0 now I got the correct point.After knowing what is the correct meaning of the platform everything is cleared.

Software programmers work in the same platform.They Writing the software in a PC & their output also in the same PC.

But we Writing the software in a PC but our output is not in a PC its in a different uC.So here its working in a different platform.
 
Nigel Goodwin said:
Any compiler for a PIC has to be a cross compiler, as there's no space in a PIC to run a compiler, nor any suitable interface/OS to run it under.

Oh yes it has to be a cross compiler.

So many people asks "what compiler you use?" thats wrong the correct term will be "what cross compiler you use?" :)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top