Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to convert C program into .ASM program ?

Status
Not open for further replies.

khushbu06

Junior Member level 1
Joined
Feb 5, 2012
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
gujarat, India
Activity points
1,385
i have a code program of a particular project in C language, but i require HEX codes, what do i do?
or how to convert it into .ASM program?
 

You have to use a Compiler..

But first of all which Controller u are using...

Explain in detail so that we can help you..
 

Use keil for compiling(converting) your asm code to hex File.
Here is an example to convert asm to hex, some images which may help you:
How to add your asm file to souce group : howtoaddfile.jpg
Now browse to the location of your asm file : howtoaddasm.jpg
double click your asm file so its will appear like this : keilasm.jpg
Now set the options/configure(to tell keil which micro-controller you are using and at what frequency) : configure.jpg
Choose your micro-controller(In devices tab), In my case It is P89V51RD2(NXP) micro-controller at 11.0592MHz : configure1.jpg configure2.jpg configurehex3.jpg
Don't forget to tick the Create Hex file Option under output tab!!!
Now just use the build target tab : buildthetarget.jpg
Now your hex File is created, Check the location : hexfilelocation.jpg

check zip file(all above images) in attachment :

Good Luck.
 

Attachments

  • buildthetarget.zip
    1.1 MB · Views: 67

to tushki:
hey thanks 4 this..
but i don't have ASM program..
i have program in C language..
i am using 89C51 microcontroller..
so first i need to convert it into .ASM and then in HEX code...

here is an attachment of that code..
 

Attachments

  • code.pdf
    41.6 KB · Views: 94

i have a code program of a particular project in C language, but i require HEX codes, what do i do?
or how to convert it into .ASM program?

If I understand your question correctly, you can use a C Compiler to directly generate the HEX file. There is no need to generate an Assembly (ASM) file as an intermediate step.

but i don't have ASM program..
i have program in C language..
i am using 89C51 microcontroller..
so first i need to convert it into .ASM and then in HEX code...

Your code appears to be written for the KEIL C51 Compiler. You can download a limited version capable of compiling your code for the 89C51 and generating a HEX file.

KEIL Product Downloads

I have compiled your code with no errors or warnings using the KEIL C51 Compiler and attached the zipped project directory.

Build target 'Target 1'
compiling main.c...
linking...
Program Size: data=42.0 xdata=0 code=1837
creating hex file from "khushbu06"...
"khushbu06" - 0 Error(s), 0 Warning(s).

Within the project directory you will also find a LST file with is the Assembly (ASM) Language Listing of the compiled C code, as well as the HEX file.

It should be mention with a few efficient code techniques the size of your C code and resulting HEX file could easily be reduced by 40%.

BigDog
 

Attachments

  • khushbu06.zip
    38.6 KB · Views: 62
because i need to have HEX code of this program to download on chip..
 

because i need to have HEX code of this program to download on chip..
If you want to convert your c file to asm only to convert it into hex code, then I must tell you that you can compile c file directly into hex. In earlier post I already mentioned how to compile/build hex file.

And Bigdogguru had already posted Hex code. check His last post attachment (Khushbu06.zip).
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top