Professional Documents
Culture Documents
How To Use Keil To Create HEX Files
How To Use Keil To Create HEX Files
Gkhan Demirkran
Gkhan Demirkran
3-Now you can press file>>new to open a blank page to write our c codes.
Copy the C code below from Mazidi, 8051 microcontroller and embedded systems: #include <reg51.h> void T0M1Delay(void); sbit mybit=P1^5; void main(void){ while (1) { mybit=~mybit; T0M1Delay(); } } void T0M1Delay(void){ TMOD=0x01; TL0=0xFD; TH0=0x4B; TR0=1; while (TF0==0); TR0=0; TF0=0; }
Gkhan Demirkran
Gkhan Demirkran
5- In order to add our C code Ccode1 into our project project1. We must add it into our project. Right click on the source group 1. And then press add files to group the source group 1..
Gkhan Demirkran
6-In order to get a hexadecimal file, a few changes must be done. Right click on Target1, press options for Target target1.
Gkhan Demirkran
Change XTAL mhz as 12. And put a tick on create hex file
7- Now, we can create our hex file. Press the button build
Gkhan Demirkran
A hex file, named project1.hex (not Ccode1.hex), is created. You can open it with notepad to see machine codes. This is an intel format hexadecimal file.