Microcontroller › 8051 › how to convert C code into hex code using keil compiler
- This topic has 30 replies, 22 voices, and was last updated 6 years, 5 months ago by shivkumar.
-
AuthorPosts
-
February 22, 2011 at 7:09 am #4905dagakshayParticipant
many of us are still consfused that what is that code whihc goes into micero controller.. the answere is ihex code famous as hex code… the comiplers provide an option to conver you c code to the hex code
here are some the simple steps to follow to convert you C file to hex file…
step 1… go to simulator… you can find ir in project work space the top one… right click on it… click on option for target
February 22, 2011 at 7:11 am #5573dagakshayParticipantstep2:
go to taget;
select the required crystal frequency
tick on on chip rom
February 22, 2011 at 7:16 am #5574dagakshayParticipantstep 3
go the output tab;
tick on creat hex file
click on ok
and built the code again
February 22, 2011 at 7:20 am #5575dagakshayParticipantFebruary 22, 2011 at 3:40 pm #5587sri.venkatramanParticipantwe are doing digital security lock system using microcontroller 89c51… The generated HEX file size is of 6 KB but the size of IC is only 2KB flash memory….they have displayed the video too for this project in this website…. how i can burn the hex file to the IC …????
February 23, 2011 at 6:04 am #5590dagakshayParticipanthello sri.venkatraman,
the at89c51 has 4Kbytes of flash….
can you send the link for the project which one (project on this site) you are talking about…
for your solution us can use s52 or c52 which as 8kb of flash… i think even they might have used the same…
one more interseting thing which might solve your doubt…
where you saw the size of your hex file?… just right click on the file and going to the properties in that way you might have checked am i right?… sir you are 100% wrong if you have assumed that is the original amount of hex which is going to be dumped in your controller…
open your hex file…
//……………………………………………………………
:100000000C942A000C9434000C9434000C943400AA:100010000C9434000C9434000C9434000C94340090:100020000C9434000C9434000C9434000C94340080:100030000C9434000C9434000C9434000C94340070:100040000C9434000C9434000C9434000C94340060:100050000C94340011241FBECFE5D4E0DEBFCDBF29:100060000E9436000C946E000C940000FF920F93D7:100070001F938FEF87BB81BB8EEFF82E04E02AEF32:1000800030E01DEFBAE0ABEF41E1F7EFEFE17FEEDB:100090006FED5FEBF8BA02BBC9010197F1F718BB2E:1000A000B2BBC9010197F1F7A8BB42BBC9010197D7:1000B000F1F7F8BBE2BBC9010197F1F778BB42BB8E:1000C000C9010197F1F768BB42BBC9010197F1F77C:1000D00058BB42BBC9010197F1F7DCCFF894FFCFC1:00000001FF//………………………………………………………………let me take one line from this hex file
:100000000C942A000C9434000C9434000C943400AA
:CCAAAATTXXXXX……XXSS
1)new line in hex file always starts from “:” (colan)
2)the first two digit shows the number of bytes in that line (all the values written in hex)…”CC”
3)the AAAA the next four digits shows from where this line should start… the starting address…
4)type of the line.. if TT=00 more lines are there in that hex file,,, if TT=01 that is the last line in that hex file…
5) XXXX……..XX is the original code that is going to be dumped into you controller..
6) at last the SS is the checksum for the complete line.
if you want the original size of your hex code you going to dump go to the second last line note the address and add the count bytes (CC) thsi will tell the original size…
the size see in the properties of file is the size of that text file which includes all the :, CC, AAAA and SS which you are not goin to dump in your controller
February 23, 2011 at 11:52 am #5601Kaustubh DeshmukhParticipantHi,
you can use NXP P89V51RD2 it is same as AT89C51 and it has 64 K of flash so no worry about memmory size. It is In Curcuit
Programmable. u do not need a separate programmer kit for programming the P89V51RD2. Just use flash magic and program through
UART .
February 23, 2011 at 2:39 pm #5603sri.venkatramanParticipantIn engineersgarage oly…
thn no other easy way to find th siz of th hex file ah..?? i need to open thn i hav too add th count bytes ah…!!!
whether anyother simple ways r there..!!
March 15, 2011 at 7:10 am #5749kallappaParticipantsir we r doing project on automatic load shedding control using gsm.
our idia is to control the relays throgh GSM , sms format is “relay number status time of ONorOFF”
plz………… help me to write the c codeMarch 15, 2011 at 8:36 am #5750dagakshayParticipantlinks:
http://www.engineersgarage.com/microcontroller/8051projects/interfacing-gsm-8051-microcontroller-circuit-code
http://www.engineersgarage.com/microcontroller/8051projects/gsm-interface-8051-microcontroller-circuit-code
http://www.engineersgarage.com/microcontroller/8051projects/interface-gsm-module-8051-microcontroller-circuit-codeApril 4, 2011 at 2:56 pm #5886romel emperadoParticipantnice tut dagakshay..
April 5, 2011 at 5:23 am #5896dagakshayParticipantthanks… please surely do add on if you know some more stuff….
April 5, 2011 at 6:57 pm #5900SaLMAN Ahmed KhanParticipantYES ABSOLUTELY I AGREE
April 5, 2011 at 6:57 pm #5901SaLMAN Ahmed KhanParticipantYES ABSOLUTELY I AGREE
June 24, 2011 at 6:05 pm #6380javvadi jyothi prasadParticipantsir, we recently done a mini project called “HOME APPLIANCES CONTROLLING USING TV REMOTE”. we are successfull. now we are in documentation stage. we need to write a chapter to describe the software used to program AT89C51 microcontroller and the dumping steps. we done the project in collaboration with anther company. we dint notice the dumping steps and process used by the company to dump the code in AT89C51. can you post the dumping steps with relevant diagrams?? they used ATMEL MCS-51 and KEIL software. please post the information…
-
AuthorPosts
- You must be logged in to reply to this topic.