views:

370

answers:

4

I've faced to a problem with a PIC Micro controller.

I have a micro-controller programmed by me long time ago and I lost the relevant source code and the schematic diagrams. Now I need to invert the value of a port. I can do this using some NOT gates but it is a big hassle to do so. or alternatively I will need to write the whole program back.

I don't expect to see the code back in PIC C or MikroC. Having an understandable assembly code would be sufficient.

So do anyone has any experience on a good HEX decompiler that I can use for this purpose? Any comments based on your experience? :)

EDIT : Device PIC 16F84A

+1  A: 

You should be able to load the hex file into the MPLAB IDE and view the assembly code from there as well as run it and step through the code in the simulater if I am not mistaken.

You can also use it to read the code from a device if it is not code protected.

Cobusve
+4  A: 

Decompilation is unlikely to be a practical solution, and it is even less likely that a tool for your specific compiler and instruction set combination even exists.

Disassembly however is straightforward, though whether you will be able to make sense of the resulting code is a different matter since no comments or symbols are preserved in the HEX file; if you have the original object code it may render the disassembly more readable. There are many PIC disassemblers available, just Google it; I can't direct you at any specific one because there are a number of PIC families with different instruction sets, and you did not specify.

A simple approach to disassembly would be to simply load your HEX file into MPLAB and select View->Disassembly Listing, then right-click the windows and select "Output to File". This output may need some massaging for it to be suitable for input to an assembler.

Clifford
A: 

The other users are just to help you but not to code for you...

anurag
I know. Did someone request you to code?
Chathuranga Chandrasekara
this is exactly what i want to ask u when u commented on my question regarding connecting iphone to mac.Did i asked u there to code for me???or it is mandatory to comment whether u know the answer or not??If u do not know the answer u need not to comment.All the best.(No offences)
anurag
-1 for inappropriately venting an irrelevant grievance.
Clifford
A: 

There is a list of PIC disassemblers at the official PICList technical reference.

Many people never use a stand-alone disassembler, but prefer to use the disassembler inside their favorite PIC simulator.

http://piclist.org/techref/microchip/dissassemblers.htm

http://piclist.org/techref/microchip/simulators.htm

David Cary