Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Modifying a HEX file

Status
Not open for further replies.

bigal_scorpio

Active Member
Hi to all,

I just wondered if anyone out there can edit a HEX file from a PIC?

I don't even know if this is possible, but I need to stop the program doing one specific thing.

The program is a RTC clock for the 16F628 and when run the program does a segment test of the LEDs. I need to stop this so I can increase the power to the segments to offset the 1/4 multiplexing loss.

Edit. I know there are programs that supposedly convert HEX to ASM, but ASM is well beyond my understanding, so even if I managed to get an ASM file I would still be lost.

Any comments guys?

Thanks Al
 
Last edited:
Hi to all,

I just wondered if anyone out there can edit a HEX file from a PIC?

I don't even know if this is possible, but I need to stop the program doing one specific thing.

The program is a RTC clock for the 16F628 and when run the program does a segment test of the LEDs. I need to stop this so I can increase the power to the segments to offset the 1/4 multiplexing loss.

Edit. I know there are programs that supposedly convert HEX to ASM, but ASM is well beyond my understanding, so even if I managed to get an ASM file I would still be lost.

Editing raw machine code is a LOT more complicated than editing assembler - plus the fact you've got to convert it from HEX to machine code, and then back to HEX again, including creating the checksums.

But regardless, you're not going to edit the HEX file without first disassembling it, and finding out what you need to change.

If the program isn't written in assembler, then it's likely to be a LOT more difficult as well, compilers (particularly C ones) produce absolutely horrible assembler code.
 
Hi Eric and Nigel,

Yes Nigel, I realise that the more processes that program goes through the more jumbled it would become.

I am hoping, well pretty sure that the author, Jose Pino, only writes in ASM. Fingers crossed.

Eric, here is the code. I hope something can be done as as it stands I can't give the LEDs what they need unless I disconnect them until after the segment check or I lose at least 1 LED in some of the strings. The first test killed 3! But once the segment test has run the LEDs run quite happily on 30v instead of 12v on 1/4 duty (the calc I did was about 15mA at 30v) still a little dimmer than the segment test on 12v which gives 17mA with the setup I have.

Thanks Al
 

Attachments

  • JosePinoClock6282-4.hex
    12 KB · Views: 146
You can edit the hex file directly in MPLAB. Go to File -> Import and import your hex file. Now go to View -> Program Memory and it shows the hex codes. Double-click on the code you want to change, and change it. Now save and export.
 
Hi Nigel,

That was quick! But what does any of it mean?

ASM is bad enough to me when it has the comments in. hehehe

Does it make any sense to anyone without the comments 'cause I'm lost here.

Al
 
Hi Nigel,

That was quick! But what does any of it mean?

ASM is bad enough to me when it has the comments in. hehehe

Does it make any sense to anyone without the comments 'cause I'm lost here.

Al

You need to break it down, here's a little start I've made, essentially breaking it up into subroutines and labelling them.
 

Attachments

  • JosePinoClock2.asm
    20.2 KB · Views: 150
Hi Nigel,

That was quick! But what does any of it mean?

ASM is bad enough to me when it has the comments in. hehehe

Does it make any sense to anyone without the comments 'cause I'm lost here.

Al

hi,
I think I have located the 8's test in the program.

The ALL 8's test is done in the same way as any other value is shown. ie: digit scanning/ multiplexed

If you have a power supply problem it could occur at other displayed values, not just the test
 
Last edited:
Hi Guys,

Nigel, I still cannot even imagine what any of the code does mate. I have learned 2 different basics so far just to avoid the ASM.

Eric, As to the power supply being wrong. Once the test is over the display is well under powered, the only time the LEDs light nicely is when the test is running. There MUST be a difference between the test and normal as in the test only one digit lights at a time so I am assuming that these are not running at the 1/4 duty cycle that the actual clock display runs at!

The program must be doing something different during the test, and just to dispel any thoughts of the PSU being too low the display is sitting on to of a 7A 12v gel cell that I use for all the 12v things I make, so it should not be under-powered.

Thanks Al
 
hi Al,
Try this hex file, also included the edited asm [ modified to remove the 8's test] courtesy of Nigel's dis-assembly file.

E
 

Attachments

  • JosePinoClock6282-4m.asm
    20.3 KB · Views: 137
  • JosePinoClock6282-4m.hex
    3.5 KB · Views: 132
Hi guys,

Thanks Nigel and Eric, that HEX works perfectly.

Now I can let the LEDs have the pep they need!

Thanks again guys. I will try and spend the next 20 years or so trying to understand ASM hehe

Al
 
Status
Not open for further replies.
Back
Top