How to convert c code to hex code for pic?

Discussion in 'Embedded Systems and Microcontrollers' started by new999, Feb 10, 2016.

  1. new999

    Thread Starter New Member

    Jan 18, 2016
    I want to write code for pic and convert it to hex file as well. what software should i use? Also please tell me alternatives to proteus as demo version does not support PICs.
  2. Sonoran Desert Tortoise


    Oct 30, 2014
    Go to the website. Look for the free software they offer to do just what you are asking.

    And, you will have better answers here if you put your question in the proper sub-forum (this one is general electronics chat. You should ask the moderator to move the thread to Microcontroller thread

    Just click the report button on the bottom of this post and say, please move to microcontrollers/embedded systems sub-forum.
    JohnInTX and new999 like this.
  3. new999

    Thread Starter New Member

    Jan 18, 2016
    Thanks got the appropriate program named micro pro for pic . Also it would be great if you could help me out with this
  4. Stuntman

    Active Member

    Mar 28, 2011
    As SDT stated, microchip has free software (the free version does have a few limitations) to write either C or Assembly for the PIC controller. The code can also be exported to a hex format using that program.

    Proteus is a schematic capture program that also supports some mcu simulation. This would mean you could use proteus to simulate your code instead of putting it on a real mcu.

    In short, you are asking about two very different tasks in your post. Writing for PIC, use MPLab, at least to get started. As for the PIC simulator, I'm not sure if anyone offers a freeware simulator, I believe you have to pay for that capability in Proteus.
  5. WBahn


    Mar 31, 2012
    MOD NOTE: Moved from General Electronics Chat.
  6. JohnInTX


    Jun 26, 2012
    I agree with the others. If you are using PIC, try MPLABX Integrated Development Environment and the free version of XC8 C compiler with a PICkit3 debugger/programmer. Most of us have it installed and can provide more help that way. Avoid 3rd party clones of the PK3.

    MikroC is used by several members too (including me) and might be an alternative. I still prefer XC8 because there are no code size restrictions in the free mode and it has some internal advantages over MikroC as well. MikroC DOES have extensive library support for common devices (LCD, PWM etc) suitable for beginners and quickie projects but not so much for more complex programs.

    Both MPLABX and MikroC provide a simulation function - MPLAB is way better IMO. You can step programs and see variables (including outputs) work in 'watch' windows. You don't get the fancy pictorial representation that you do in Proteus but it does the job. Proteus simulations sometimes don't have the fidelity you would want making transition to actual hardware problematic.

    Finally, since you are just starting out, consider something from the PIC 18F or 16F1xxx (enhanced midrange) families. These have much better internal architectures, better IO, more memory etc. for virtually the same price.
    Last edited: Feb 10, 2016
    absf likes this.