need helpconvert PIC mcu hex file into C-languag

Discussion in 'Programmer's Corner' started by linda321, Jun 17, 2013.

  1. linda321

    Thread Starter New Member

    Jun 7, 2013
    1
    0
    I need to convert PIC mcu hex file into C-languag?any one can do it?
    thanks
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    It's theoretically possible, not so in any practical way.

    You either need to learn programming in C and write your own code, or if this is your own code then you need to take better care of your source.
     
  3. mitko89

    Member

    Sep 20, 2012
    123
    19
    You can turn the hex into assembly, but the resulting assembly code will be close to impossible to understand (all the variable, labels will be changed with names that give you no information as well as there will be no comments). I have never searched or needed an Assy to C converter...
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,418
    3,355
    Sounds like someone attempting to reverse engineer code or trying to copy and modify another's intellectual property. Good luck!
     
  5. mitko89

    Member

    Sep 20, 2012
    123
    19
    If you try to build the project from sketch it would be much easier and educational. I once tried to reverse engineer the source code for a welding controller... It took me 2 days to get annoyed and few hours to do it myself...
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    In a career spanning a half century, I've had occasion to disassemble a program exactly once. It was both educational and practical. The CP/M operating system had a debugger and disassembler that was based on the Intel 8085 chip. When run on a Z80 it worked fine but it would not disassemble Z80 opcodes. I recreated the assembly language source from the running program and modified it to my needs.

    In my estimation your chances of recreating C from hex are as close to nil as it is possible to get.
     
  7. mitko89

    Member

    Sep 20, 2012
    123
    19
    @Papabravo You sir, are by long shot better than me at this for sure. I only wanted to imply that converting from lower to higher level is quite troublesome (the only conclusion I could get myself). I didn't assert it's not educational or practical, but in order to be able to deal with that, for sure more than basic knowledge is required.
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    We're both on the same page on this one. This task also took the better part of my summer on unemployment in 1982. This was not a one or two day knock it off in a flash type project.

    The only weekend project (cs.1968) I can remember in that same half century career was working for a time sharing company and being handed an inch thick stack of handwritten paper on Monday morning written by Ed Yourden who was a consultant. It was an assembler for a PDP-8 minicomputer written in assembly language for an SDS-940. My job was to key it in on an ASR-33 teletype and get it working. It was done by Friday.
     
  9. mitko89

    Member

    Sep 20, 2012
    123
    19
    @Papabravo I had to google the names of the machines you mentioned. I feel both impressed and depressed as reading about your work. I am about to get my MA in Electronics in 2 months yet I realize my knowledge and abilities are close to nothing compared to these of those before me.
     
Loading...