Can anyone help with a PIC16F636 program??

Started by Govmnt_Lacky, September 25, 2020, 08:55:40 AM

Previous topic - Next topic

Govmnt_Lacky

I have a BIN file for a PIC16F636 that I need to modify. Problem is... I have no earthly idea how to modify it, where to start, etc. I know what I want done to change the functions of the PIC. I have a PicKIT2 system.

Can anyone walk me through it or assist me in making the changes?

Any help is appreciated. Thanks!  8)
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

ElectricDruid

I've not come across .bin files being used for PIC stuff. The Microchip tools produce .hex files for burning to the chip. Still, it's probably the same thing.

Assuming it is...

You've got a wonderful world awaiting you! You have to disassemble the file to get back to mnemonics. Since the code will have lost any identifiers (like comments, address labels, or constant names, or other useful stuff the compiler lets you do) you're stuck with a load of hex numbers. You'll have to work out from the code itself what the variable names should be, what the sections are, what the look-up tables mean, etc etc etc. It's not *impossible* to reconstruct source code like this, but it's tedious and time-consuming.

What does the code do? What does it need to do once modified? Honestly, you might find it quicker and easier to start from scratch if it's not something super-sophisticated.

Ice-9

Yeah the .bin file is like the .hex file which is a compiled version of the program and pretty useless unless you can decompile the file into a meaningful program. Do you also have a .asm file as this is what will make editing much easier as it is the machine code for the PIC chip.  If you only have the .bin or .hex it is still possible to get to some sort of useful code with a pic decompiler.
www.stanleyfx.co.uk

Sanity: doing the same thing over and over again and expecting the same result. Mick Taylor

Please at least have 1 forum post before sending me a PM demanding something.

Govmnt_Lacky

Currently I am using the PIC as a 5V controller and distributor. My problem with the program right now is that a few of the 5V outputs are ON constantly and I only want them on for 1-2 seconds upon command.

I know I have the BIN file. I may have the HEX file but I need to look for it (it's been a while since I got it) other than that... I'm certain I don't have any other formats.
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

potul

I found this somewhere in Internet...

Quote
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.

looks like you can disassemble directly in MPLAB.

Govmnt_Lacky

I appreciate the replies and help guys! I think I may have to shelf this for now. Just do not have the time to learn how to do all this from scratch. When it comes to programming PICs, I have ZERO knowledge on the subject.  :(
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

Govmnt_Lacky

If anyone can walk me through it or, wants to take a crack at it... let me know  ;)
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

potul

I have never disassembled a PIC bin, but I have experience in PIC ASM. If you want to give it a try just let me know and I can try to guide or help.

First thing should be to find a way to convert the bin file to hex. And find a disassembler for it.

I have an old MPLAB installed in a virtual machine, but I don't know if it has the "disassemble" function of MPLABX. I can try to investigate

potul

What can happen is that after getting working ASM, maybe it's so complex that we don't know how to modify it....

Govmnt_Lacky

Quote from: potul on September 30, 2020, 07:59:50 AM
I have never disassembled a PIC bin, but I have experience in PIC ASM. If you want to give it a try just let me know and I can try to guide or help.

First thing should be to find a way to convert the bin file to hex. And find a disassembler for it.

I have an old MPLAB installed in a virtual machine, but I don't know if it has the "disassemble" function of MPLABX. I can try to investigate

I was able to find the HEX file for the PIC. I guess I used the PickIT2 GUI to convert from HEX to BIN and saved it and have been using that ever since.
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

potul

#10
good, if you can send me the HEX file I can try to disassemble and we start from there.

I have a freeware disassembler for PICs and MPLAB installed. I will try both methods and see what is the result.


Govmnt_Lacky

Quote from: potul on October 01, 2020, 03:24:22 AM
good, if you can send me the HEX file I can try to disassemble and we start from there.

I have a freeware disassembler for PICs and MPLAB installed. I will try both methods and see what is the result.

PM'd
A Veteran is someone who, at one point in his or her life, wrote a blank check made payable to The United States of America
for an amount of 'up to and including my life.'

Henderson95

The gadget and update information is put away in the Device ID situated at 2006h in program memory.

potul


garcho

  • SUPPORTER
"...and weird on top!"