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.

Hex Generator?

Status
Not open for further replies.

AceOfHearts

New Member
After having battled with Crossware's 8051 Development Suite for a long time now, I am turning to a different kind of solution.

There are a lot of people who use freeware in the process of developing microcontroller systems, atleast I seem to hear it in discussion forums.

The only problem for me is the hex files that do not come out right. So I was wondering if anywone knows of any assembly to hex converter out on the web, which I can use to convert my assmebly codes into Hex file?

I have done google search, but could not find anything.

Many thanks!

peace.
 
Almost every assembler out there for the 8051 produces a .hex file. That said, if you can't get the supported crossware system to do what you want, how do you expect to deal with unsupported freeware. It would be nice if you had a greater understanding of the hardware platform, but I think you are giving up too easily. Since they guy at crossware was able to construct a working file you can also.
 
It sounds like you're blaming the compiler for your lack of understanding of the 8051 or programmer.

It's common to blame the tools, I see it all the time.

First what programmer are you using? A homemade one possibly of poor design or something so old it has zero chance of working with a modern operating system?

Can you read / write / modify bytes on the 8051 with your programmer?

I googled 8051 assembler, lots of hits.
https://www.google.ca/search?source=ig&hl=en&q=8051+assembler&btnG=Google+Search&meta=
 
It may be a 'lack of understanding' but hey, Im doing all this so I can gain some understanding!

Ok, I am patiently sticking with Crossware. I am pretty sure it is something minor that I need to get around. Once I have identified the problem, it would be sorted for good.

Yes I can connect and write to my 8051 chip (using FLIP).

The guy at Crossware could not help identify my problem. But he did get a working hex file from the same code (I emailed to him).

Here is the code I wrote:

ORG 0

HERE: MOV A, #255
MOV P1, A

ACALL DELAY

CLR A
MOV P1, A

ACALL DELAY

SJMP HERE

DELAY: MOV R5, #7
HERE1: MOV R4, #255
HERE2: MOV R3, #255
HERE3: DJNZ R3, HERE3
DJNZ R4, HERE2
DJNZ R5, HERE1
RET

END

Here is my hex file:

:1040000031303338383931360050726F647563653A
:1040100064206279207468652043726F73737761DE
:104020007265204E6F6E2D436F6D6D6572636961B1
:104030006C2044656D6F6E73747261746F720043AF
:104040006F70797269676874202863292032303074
:10405000312043726F737377617265204173736FA0
:0740600063696174657300E0
:0440670074F4F58078
:02406B000167EB
:00000001FF

here is his hex file for the same code:

:1000000074FFF590110DE4F590110D80F37D077CE0
:0A001000FF7BFFDBFEDCFADDF622C9
:00000001FF

His hex file works on my 8051, but my one does not.

If I try an even more simple code:

; 8051 Initial Assembler Source File
public START
program segment code
rseg program
START ; startup code jumps to label START
; TODO: Add your assembler source code here

MOV A, #255
MOV P0, A
END

Here is the hex file I get for this one:

:1040000031303338383931360050726F647563653A
:1040100064206279207468652043726F73737761DE
:104020007265204E6F6E2D436F6D6D6572636961B1
:104030006C2044656D6F6E73747261746F720043AF
:104040006F70797269676874202863292032303074
:10405000312043726F737377617265204173736FA0
:0740600063696174657300E0
:0440670074FFF5806D
:03406B00024067A9
:00000001FF

It looks very similiar to the other one.

I am doing my best to figure out where it is I am going wrong.

At the moment I have an LCD waiting to be programmed and code all typed up, as I want to, and need to learn to program these devices over the summer, and time is rolling on fast with this unexpected problem which has halted my progress.

I am wondering if it could be anything to do with the fact that I am on Vista.

I appreciate the help I have received here.
 
Last edited:
AceOfHearts said:
It may be a 'lack of understanding' but hey, Im doing all this so I can gain some understanding!

Ok, I am patiently sticking with Crossware. I am pretty sure it is something minor that I need to get around. Once I have identified the problem, it would be sorted for good.

Yes I can connect and write to my 8051 chip (using FLIP).

The guy at Crossware could not help identify my problem. But he did get a working hex file from the same code (I emailed to him).

Here is the code I wrote:

ORG 0

HERE: MOV A, #255
MOV P1, A

ACALL DELAY

CLR A
MOV P1, A

ACALL DELAY

SJMP HERE

DELAY: MOV R5, #7
HERE1: MOV R4, #255
HERE2: MOV R3, #255
HERE3: DJNZ R3, HERE3
DJNZ R4, HERE2
DJNZ R5, HERE1
RET

END

Here is my hex file:

:1040000031303338383931360050726F647563653A
:1040100064206279207468652043726F73737761DE
:104020007265204E6F6E2D436F6D6D6572636961B1
:104030006C2044656D6F6E73747261746F720043AF
:104040006F70797269676874202863292032303074
:10405000312043726F737377617265204173736FA0
:0740600063696174657300E0
:0440670074F4F58078
:02406B000167EB
:00000001FF

here is his hex file for the same code:

:1000000074FFF590110DE4F590110D80F37D077CE0
:0A001000FF7BFFDBFEDCFADDF622C9
:00000001FF

His hex file works on my 8051, but my one does not.

If I try an even more simple code:

; 8051 Initial Assembler Source File
public START
program segment code
rseg program
START ; startup code jumps to label START
; TODO: Add your assembler source code here

MOV A, #255
MOV P0, A
END

Here is the hex file I get for this one:

:1040000031303338383931360050726F647563653A
:1040100064206279207468652043726F73737761DE
:104020007265204E6F6E2D436F6D6D6572636961B1
:104030006C2044656D6F6E73747261746F720043AF
:104040006F70797269676874202863292032303074
:10405000312043726F737377617265204173736FA0
:0740600063696174657300E0
:0440670074FFF5806D
:03406B00024067A9
:00000001FF

It looks very similiar to the other one.

Sure it may be my 'lack of understanding', but I am doing my best to figure out where it is I am going wrong.

At the moment I have an LCD waiting to be programmed and code all typed up, as I want to, and need to learn to program these devices over the summer, and time is rolling on fast with this unexpected problem which has halted my progress.

I am wondering if it could be anything to do with the fact that I am on Vista.

I appreciate the help I have received here.
I can tell from reading the hex files that your code is being loaded at address 0x4000. It may also have support code for a debugger or monitor. The crossware guys file has none of that. Use FLIP to load your hex file. Then use the Buffer Edit featur to look at the data at address 0x4000.

What is there looks like a string of ascii characters rather than actual code. The contents of the string may give you a clue.

Your code is on the line that begins:
:0440670074FFF5806D

The 74FF is the MOV A,#255
 
Last edited:
I found a solution to the problem, Thank God.

It seems to work when I embed my assmbly file into a C project using

#asm and #endasm command

Strange, it does not work when I make a dedicated assembly project...
 
Last edited:
use this program

Edit the asm.bat file.
change "hexfile.ASM" to the name of your asm file.

also, you must have
$mod51
before org 0 statement

just double click on the asm.bat file in windows
and it will produce a hex file in the same folder.

If there are any errors, they will appear in the hexfile.lst file
(or whatever you call the asm file) that will be created by the assembler.

Good luck

edit: file was removed, download asm2.zip (see post below)
 
Last edited:
johnsmith123 said:
Edit the asm.bat file.
change "hexfile.ASM" to the name of your asm file.

also, you must have
$mod51
before org 0 statement

just double click on the asm.bat file in windows
and it will produce a hex file in the same folder.

If there are any errors, they will appear in the hexfile.lst file
(or whatever you call the asm file) that will be created by the assembler.

Good luck

Hi there,

I am very grateful for the compiler. Thanks very much.

However, my .lst file lists loads of errors for some reason, even when my .asm file does not have any. I get a .hex file output which does not work when I try to load it into FLIP.

And when I put &mod51 statement before I compile my .asm file, I get errors - so I tried putting it in after compilation, I dont know if that would work though.

Thanks again for your help, waiting to hear (further instructions) from you again.
 
Last edited:
Hello
I hope am understanding you right.
You need a compiler nit a converter to compile you assembly code. With some library according to the controller you are using.
Pleas more detail so hope I can help
waleed
 
try this

I assembled your source without any errors. You probably made a mistake in the bat file, or something is wrong with the source code.

Look in this zip file. The source code is in there with the edited bat file. It works.

You will see the compiled hex file and lst file also.

Download this zip file and delete the old one. I removed it from the server.

Good luck
 

Attachments

  • ASM2.zip
    46.5 KB · Views: 128
waleed2m said:
Hello
I hope am understanding you right.
You need a compiler nit a converter to compile you assembly code. With some library according to the controller you are using.
Pleas more detail so hope I can help
waleed

Sorry, yes, it is a compiler I need.

Appologies for the late reply.

Thanks for the clarification johnsmith123.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top