DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: Govmnt_Lacky on September 25, 2020, 08:55:40 AM

Title: Can anyone help with a PIC16F636 program??
Post by: Govmnt_Lacky on September 25, 2020, 08:55:40 AM
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)
Title: Re: Can anyone help with a PIC16F636 program??
Post by: ElectricDruid on September 25, 2020, 04:27:56 PM
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.
Title: Re: Can anyone help with a PIC16F636 program??
Post by: Ice-9 on September 26, 2020, 01:55:17 PM
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.
Title: Re: Can anyone help with a PIC16F636 program??
Post by: Govmnt_Lacky on September 26, 2020, 03:47:42 PM
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.
Title: Re: Can anyone help with a PIC16F636 program??
Post by: potul on September 27, 2020, 01:12:57 PM
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.
Title: Re: Can anyone help with a PIC16F636 program??
Post by: Govmnt_Lacky on September 28, 2020, 08:57:21 AM
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.  :(
Title: Re: Can anyone help with a PIC16F636 program??
Post by: Govmnt_Lacky on September 30, 2020, 07:24:08 AM
If anyone can walk me through it or, wants to take a crack at it... let me know  ;)
Title: Re: Can anyone help with a PIC16F636 program??
Post by: 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
Title: Re: Can anyone help with a PIC16F636 program??
Post by: potul on September 30, 2020, 09:27:03 AM
What can happen is that after getting working ASM, maybe it's so complex that we don't know how to modify it....
Title: Re: Can anyone help with a PIC16F636 program??
Post by: Govmnt_Lacky on September 30, 2020, 10:29:52 AM
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.
Title: Re: Can anyone help with a PIC16F636 program??
Post by: 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.

Title: Re: Can anyone help with a PIC16F636 program??
Post by: Govmnt_Lacky on October 01, 2020, 07:32:51 AM
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
Title: Re: Can anyone help with a PIC16F636 program??
Post by: Henderson95 on March 02, 2021, 05:38:22 AM
The gadget and update information is put away in the Device ID situated at 2006h in program memory.
Title: Re: Can anyone help with a PIC16F636 program??
Post by: potul on March 02, 2021, 08:34:51 AM
spambot?
Title: Re: Can anyone help with a PIC16F636 program??
Post by: garcho on March 09, 2021, 09:56:47 AM
So many lately