Results 1 to 5 of 5

Thread: Assembly/C/C++?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    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

    Visual Studio 2010

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Posts
    122
    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!

  3. #3
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306

    This is based on what I know...

    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.
    Designer/Programmer of the Comtech Operating System(CTOS)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    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

    Visual Studio 2010

  5. #5
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    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
    Designer/Programmer of the Comtech Operating System(CTOS)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width