PDA

Click to See Complete Forum and Search --> : Assembly/C/C++?


softwareguy74
Apr 20th, 2001, 02:01 PM
Hi,

I'm very interested in learning about programming microconrollers and thanks to Warmaster199 from the C/C++ forum, I think I'm on the right track.

But I have a question regarding the language that the microcontroller understands.

It is my assumption that these microcontrollers only understand Assembly. So when you program one of these chips with C/C++ or Basic, the compiler just translates these higher level languages to the lower level Assembly language, is that correct?

If not, any help on the relation between higher/lower level languages in regards to microcontrollers would be appreciated.. I have also heard that you can make your own compiler, is that true?

Dan

Cybrg641
Apr 20th, 2001, 03:40 PM
The ONLY thing the computer understands is machine code ( 1's and 0's) not Assembly. Every program you write is actually written in machine code. When you compile a high level language, I believe it translates that into binary and usually puts it into a .obj file. When you link the program, it then makes the .exe file that you can run. In assembly language, you assemble instead of compile but they are basically the same thing. I hope this helps out!

Warmaster199
Apr 20th, 2001, 04:59 PM
Cybrg641 is right. The compiler compiles the source code into 1's and 0's. The only reason why it sounds like they can only do ASM is that usually there aren't C compilers made specially for the COP8, or the PIC. I do know for sure that there are C compilers for the 68HC11 microcontroller.

Assemblers can make code for any chip because YOU tell the assembler what operatives to do. You code DIRECTLY with the CPU's internal commands. With a C compiler, there are commands, but they are translated into the machine code for the specific machine you use it for (An x86 C compiler like BorlandC or PowerC most likely WILL NOT generate code for a Mac).

Like Cybrg641 said, in assembly, it assembles your commands into 1's and 0's. But with a C compiler, It has to compile. There is a slight difference.

softwareguy74
Apr 20th, 2001, 05:44 PM
Thanks guys! That really helps...

So then when we talk about the OOPic having objects, in reality, it's their software developement tool that provides the objects and just assembles it into machine code for the PIC to understand, right? It's not that the objects are actually built into the chip, right?

Thanks,

Dan

Warmaster199
Apr 21st, 2001, 12:09 AM
Actually, you just send your source code to the OOPIC itself. It then translates/Interprets the source code and acts on it. It's somewhat different. The same goes for the BASIC STAMP II