Convert PIC code from Assembly language to C/C++

Discussion in 'Embedded Systems and Microcontrollers' started by RG23, Aug 21, 2012.

  1. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    I need to convert PIC code from Assembly language to C/C++.

    Please let me know the correct approach

    Thanks
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    The correct approach is:
    1. Understand the assembly language program
    2. Implement the functionality in C .OR.
    3. Implement the functionality in C++
    AFAIK there is no automated way to do this.
     
  3. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    What C/C++ compiler are you using?? What processor/microprocessor was the code written for?
     
  4. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    I am using mikroC PRO for PIC from Mikroelektronika

    PIC18f67J90

    Initially I used MPLAB IDE

    The code works fine there

    Will converting to C also help me to reduce the memory gauge?

    Also if anyone has an example from assembly to c/C++ please let me know

    Thanks
     
  5. RG23

    Thread Starter Active Member

    Dec 6, 2010
    301
    2
    The correct approach is:
    1. Understand the assembly language program
    2. Implement the functionality in C .OR.
    3. Implement the functionality in C++
    I have written the code in assembly language so check step1

    I need to know how to implement in C/C++
     
  6. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Pretty unlikely unless the assembly code is badly written.
     
  7. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    It is easier to modify C in terms of saving memory space.
    Some algorithm can be replaced with a better one...

    OP should give the source code in question, or at least, parts of it, so members here can give an estimate. It's not totally needed to show the complete source.
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    You should start with a reference on C like:

    http://www.amazon.com/Programming-L...qid=1345567973&sr=1-1&keywords=The+C+language

    A bargain at $32 and change
     
  9. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    Convert very carefully and possibly one subroutine/function at a time and check it.

    I converted 300,000 lines of PC assembler into Delphi and took that approach.
    I still had one or two bugs but got there in the end.
     
Loading...