Microcontroller › 8051 › C code to assembly code
- This topic has 21 replies, 12 voices, and was last updated 8 years, 8 months ago by aaliyan.
-
AuthorPosts
-
March 9, 2011 at 8:01 am #4730dagakshayParticipant
hi every one many a times i got this kind of query that how to convert the C code to assembly code, the code given on this site is in C language i need the asm code, i dont know C, can you send me the asm code…. i prefer if you use C since it is common plateform, but when you go for core design were each and every cycle of the microcontroller does matter alot then you have to go for assembly code. and also it is a bit bitter/complex (atlest for me) to code using asm… but i personaly belive asm language is very versatile and a veery good way for efficent use of microcontroller… and one who had wrote the code in C must have a look at the asm code what is generated by the compiler itself so that i will make you habitual towards asm code….
here i am writing few steps to see the asm code for the c code you have wote ( i have used keil complier here)…..
step 1:
save your file with “*****.C” (dot c) extension…. (which you generally do)….step 2:
after you have built you the file… go to start debug option… debug-> start/stop debug session
step 3:
now go veiw -> disassembly windowstep 4:
a new window will pop up, or click at he disassembly tab shown the the below pic marked in the red at the bottom….
the first red block says 12: 13:……16: is the line of your c code and corresponding to that your C code is given in just next adjusant block…
the third red block below that is the asm code for your corresponding C code generated by compiler itself…same the 17th line code is marked in green and below it the asm code is given…
if you have any further or any futher knowledge related to this topic share on this forum
cheers
-DagakshayApril 4, 2011 at 1:28 pm #5881romel emperadoParticipanthi.. is the generated asm is exactly the equivalent code of what you wrote in C?
April 5, 2011 at 4:27 am #5890dagakshayParticipantyup romel,
that will be the exact equivallent asm code for the corresponding C code… but we can make a far better, effect or optimized equivallent asm code… since there is no option for optimization is given in KEIL as in AVR studio…..
April 5, 2011 at 4:35 am #5891romel emperadoParticipantthanks… got it..
April 14, 2011 at 6:01 pm #5976SaLMAN Ahmed KhanParticipantMEANS AVR STUDIO CAN BEST TRANSLATE??? C TO ASM?
April 15, 2011 at 5:16 am #5980dagakshayParticipantactully not the bst but ya it can be a better option… just depends on comparsion
April 18, 2011 at 11:12 pm #5996Chris S.Participanthey, where can i go to download the program Keil compiler to try this?
April 20, 2011 at 12:46 pm #6009dagakshayParticipanti have already posted some links her on this forum.. check my last post on this froum(below given is the forum link)
April 26, 2011 at 1:25 pm #6038dagakshayParticipanthello anil i dint understand your point…
May 3, 2011 at 12:05 am #6078Chris S.Participantcan someone help me every time I try to use the program it only assemble the default sample code…..Help Please!!!
May 6, 2011 at 9:40 am #6092dagakshayParticipant@ shaun i dint get you what kind of help you want.
@ Ronald. yes you are correct. that the same
August 21, 2011 at 4:24 pm #6618khalidParticipantThanks for the wonderful post Dagakshay,
I tried it on uvision 4 and it gave me nothing but “NOPs”
The code I used was copied straight from an Engineersgarage project.
Any ideas why?
tq
January 25, 2012 at 2:03 pm #7075bobbyParticipantsir could u please tell me the frequency that is to be used in xtal column for this project Automatic bidirectional visitor counter using 8051 microcontroller (AT89C51) posted on this site.http://www.engineersgarage.com/microcontroller/8051projects/Bidirectional-visitor-counter-AT89C51-circuit
March 27, 2012 at 1:31 pm #7338meghanaParticipantHey dagakshay i tried converting the code following the above steps of bidirectional visitor counter (http://www.engineersgarage.com/microcontroller/8051projects/Bidirectional-visitor-counter-AT89C51-circuit) from the given C code to asm in keiluvision
But the only instruction i could see in the disassembly window was NOP..
Can you please tell why?
or please send me the corresponding asm code of it..
Thanx..
August 5, 2012 at 2:24 pm #8399bhaveshParticipantPlease give me microcontroller program of automatic bidirectional visitor counter.
i have it’s code from this site but i don’t know how to convert.
so,pls convert this code into asm file send me on my mail account which is:-
-
AuthorPosts
- You must be logged in to reply to this topic.