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.

Changing the hex code

Status
Not open for further replies.
The problem is: i dont know re-copiler. Do you can say me what are the rigth tools to do that? Pls help me... i wanna learn about copilation process... :eek:
 
anthony123 said:
The problem is: i dont know re-copiler. Do you can say me what are the rigth tools to do that? Pls help me... i wanna learn about copilation process... :eek:

A free assembler is available at www.microchip.com its the MPLAB IDE7.xx.

**broken link removed**

Download and install into your PC, use the Help files in the MPLAB.
 
There seem to be two choices to do what you want to do: 1) Edit the hex code directly; or
2) Edit the source code ("algorithm") and compile to give new hex code.

The first choice in my view is much more difficult, particularly if you are not familiar with coding. You have to use a hex editor, not a text editor. If you use a text editior, it may seem to work from what you see on the screen, but it won't work when you try to re-program the chip. I have used a hex editor couple of times in my work when I did not have access to the source code, but I did have access the hex code. In fact, I did essentially what you are trying to do, namely change the names of some variables. However, as I just stated, it would not be my first choice, since the source code is available in the "algorithm."

The second choice is easiest. The steps in the algorithm that spell out the greeting can simply be change to other letters to spell anything you want. Then when you program the chip the language of the "algorithm" will be converted to hex code by the compiler.

I cannot get much more detailed than that without know what you have for a programmer and whether you are familiar with assembler (assembly) language.

John
 
jpanhalt said:
The first choice in my view is much more difficult, particularly if you are not familiar with coding. You have to use a hex editor, not a text editor.

Not true, a HEX file is just a standard ASCII text file, Notepad is all you need to edit it - a HEX editor would offer no advantage, and probably put disadvantages in your way?.

However, it's a SERIOUSLY bad idea, you first have to understand fully how a HEX file is constructed (it's explained in the MPASM helpfile), and then how to create the values for one, including the correct checksum value.

Far, far easier to load it in MPLAB and alter the source code, then re-assemble it.

You could also load the HEX file in WinPicProg, and manually edit the HEX files there - as it's displayed as pure machine code, bit for bit, rather than the Intel HEX file format.

But re-assembling the source is the way to go! - if you can't do that, you can't do the other options as they are more difficult.
 
Nigel Goodwin said:
Not true, a HEX file is just a standard ASCII text file, Notepad is all you need to edit it - a HEX editor would offer no advantage, and probably put disadvantages in your way?.

My error, I was just speaking from experience. The program was on floppy and the instrument used a PC, not a microcontroller. The file was an *.exe extension. My first attempt used Notepad on the assumption it was just ASCII. But that totally flopped. Of course, there were lots of nonsense characters. I used a hex editor freedbie, made the same changes to the characters, and it worked. Somewhat later, I read that one could not simply edit an exe file with Notepad and expect it to work.

I certainly defer to your experience and suspect I made an incorrect leap in assuming the exe was simply a hex file. Thank you for the correction. John
 
Last edited:
will be something like this???
Code:
; name    : JP6293E
; author  : Anthony Sotillet
; date    : 07/01/08

; Microcontroller:  12f629 Speed: 4 Mhz Internal RC

delay 200 miliseconds
Set Comparator Mode 7


variable byte f = 00000000b   ; Output data
variable byte s                  ; Temporal variable
variable byte o                  ; message number.

procedure salida( s as byte ) is
gpio = s
delay 500 us
gpio = 00000000b
delay 200 us         
end procedure

procedure disp ( f as byte ) is
if f = "0" then f = "O" 
if f = "A" then
   salida(0011_0110)
   salida(0000_0101)
   salida(0000_0101)
   salida(0011_0110)
end if
if f = "H" then
   salida(0011_0111)
   salida(0000_0100)
   salida(0000_0100)
   salida(0011_0111)
end if
if f = "N" then
   salida(0011_0111)
   salida(0000_0010)
   salida(0000_0100)
   salida(0001_0000)
   salida(0011_0111)
end if
if f = "O" then
   salida(0001_0110)
   salida(0010_0001)
   salida(0010_0001)
   salida(0001_0110)
end if
if f = "T" then
   salida(0000_0001)
   salida(0011_0111)
   salida(0000_0001)
end if
if f = "Y" then
   salida(0000_0001)
   salida(0000_0010)
   salida(0011_0100)
   salida(0000_0010)
   salida(0000_0001)
end if
if f = "h" then         ; 'h' lowercase = Hearth character
   salida(0000_0010)
   salida(0000_0111)
   salida(0001_0111)
   salida(0011_0110)
   salida(0001_0111)
   salida(0000_0111)
   salida(0000_0010)
end if
if f = " " then        ; space character.
   delay 4 miliseconds
end if
delay 1 milisecond
end procedure

; main program
gpio = all output

if o = 0 then
; Display  "BE HAPPY   "
o = o + 1
forever loop
disp("A")
disp("N")
disp("T")
disp("H")
disp("O")
disp("N")
disp("Y")
disp(" ")
disp("h")
end loop
end if

o = 0
salida(0000_0000)
sleep microcontroller   ; sleep command
nop   ; No operation
 
anthony123 said:
Hi, i'm trying to put my name (anthony) into this air display but i cant :(
I do it with autor's page code and works excellent!!!!
Thankss :rolleyes:
TRY THE ATTACHED FILE ANTHONY123
 
Last edited:
Hi Anthony,

it would be a good idea to post the exact authors code which is normally displayed.

I translated a BMS computer program from English to German without touching any other Bit, just replaced the English text with German. The program works fine with no malfunctions.

I have two powerful hex editors and finding the author's code it will be changed very quickly.

Assuming the author didn't deliver the source code (why should he?) the only way to apply changes is going directly to the hex code.

Disassembling would be another choice, but do you know which language was used to create the hex file?

Boncuk
 
Boncuk said:
Hi Anthony,

it would be a good idea to post the exact authors code which is normally displayed.

I translated a BMS computer program from English to German without touching any other Bit, just replaced the English text with German. The program works fine with no malfunctions.

I have two powerful hex editors and finding the author's code it will be changed very quickly.

Assuming the author didn't deliver the source code (why should he?) the only way to apply changes is going directly to the hex code.

Disassembling would be another choice, but do you know which language was used to create the hex file?

Boncuk

His interest appears to be just to see whether he could see his name -- Perhaps thereafter he would practice the PICbasic or assembly.
 
mvs sarma said:
His interest appears to be just to see whether he could see his name -- Perhaps thereafter he would practice the PICbasic or assembly.
I only want show my name and learn how!!

PD: I dont know use the MPLAB as well as you!! i even dont copile an one single
code in the MPLAB :confused:
 
anthony123 said:
I only want show my name and learn how!!

PD: I dont know use the MPLAB as well as you!! i even dont copile an one single
code in the MPLAB :confused:

Never too late to learn, that would be much easier than trying to modifiy the hex file.
**broken link removed**

Here's a flash video I'm working on for using MPLABs Wizard
**broken link removed**
 
Thanksssssss!! But i know that part, the part that i dont know do is copile the code!! As well as it, i dont know what languaje is the algorimth!!

Help please!!
 
anthony123 said:
Thanksssssss!! But i know that part, the part that i dont know do is copile the code!! As well as it, i dont know what languaje is the algorimth!!

Help please!!

if you write software in basic (say MEL PICbasic using some editor , if you know basics of BASIC)), you need pic basic compiler to be able to compile and get HEX code.

Otherwise, suppose you write the software in Assy language, you can compile it using MPLAB IDE.

for a better understanding as to how to compile an assembly language code,
try to take an existing file. store it say in C:\ or say D:\ file . Don't store in folders like my documents or desktop-- the path becomes longer.

open MPLab
click open and load the file that you saved with .asm extension.
the file opens in another window
see the chip used there in a statement like "list p=p16f84"
now click "config" on the to bar of the mplab-- click "select device"
select the device for example -- same as what you find in the list statement

click"OK" and close that sub page

the click "project" and click "quickbuild"

If the file you have is correct, it will compile and store related files including .HEX file also in the same folder where you stored your original file

now call the programmer driver
say for example winpic800

here you select the Hardware form the options at the top as you might have JDM programmer select JDM
then select the chip for which you have the software hex file
insert the same type chip ( A BLANK ONE- otherwise you may have to erase the chip))in the location as specified by the programmer hardware
click" load", and select the hex file by browsing to the folder where the hex file just created is located and select it
it will appear in the window below.

then click program button.
if everything goes well and your PC and programmer are compatible and the programmer has been wired properly, it will result a programmed chip

a long description-- and all the best
 
I talk with the algorith's autor, and he said me that i cant use it, i have to translate to a usual languaje (assambler, PicBasic) and later copile it! :D
 
If you download and install MPLAB from Microchip, you can import the hex file and modify it.
You see the B near the end of the highlighted line, that is the B in "BE HAPPY" you can see the other letters 4 character further on. You can double click these and change them.

Have fun.

Mike.
 
Last edited:
i have loaded the .hex file in winpic800 and opened the 'data' window. there I could change the text . then I saved it back as some other file.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top