[SOLVED] Can anyone provide me the hex file of my c code?

Status
Not open for further replies.

zahid0055

Newbie level 3
Joined
Jul 30, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
I got a .c file from **broken link removed** . I have edited the file for my own program but I can not compile it to build the .HEX file. Can anybody help me making the .HEX file for my .c file???

Code:
#include<reg51.h>
sbit row1 = P1^1;
sbit row2 = P1^0;
sbit row3 = P1^3;
sbit row4 = P1^2;
sbit row5 = P1^5;
sbit row6 = P1^4;
sbit row7 = P1^7;
sbit row8 = P1^6;

void delay(unsigned int y)
{
	unsigned int x;
	for(x=0;x<y;x++);
}
void main()
{
unsigned int a;
P1 = 0xff;
a=150;
	while(1)
	{
	   //////////////////////T
	   row2=0;row3=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////T


	   //////////////////////E
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////E


	   //////////////////////A
	   row3=0;row4=0;row5=0;row6=0;row7=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row3=0;row4=0;row5=0;row6=0;row7=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////A



		////////////////////M
		row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	    delay(a);
		P1 = 0xff;
		row3=0;
		delay(a);
		P1 = 0xff;
		row4=0;
		delay(a);
		P1 = 0xff;
		row5=0;
		delay(a);
		P1 = 0xff;
		row4=0;
		delay(a);
		P1 = 0xff;
		row3=0;
		delay(a);
		P1 = 0xff;
		row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	    delay(a);
		P1 = 0xff;
		delay(a);
		delay(a);
		delay(5000);
		delay(5000);
		//////////////////M


		//////////////////////I
	   row2=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
       delay(a);
	   P1 = 0xff;
	   row2=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////I


	   //////////////////////N
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row3=0;
	   delay(a);
	   P1 = 0xff;
	   row4=0;
	   delay(a);
	   P1 = 0xff;
	   row5=0;
	   delay(a);
	   P1 = 0xff;
	   row6=0;
	   delay(a);
	   P1 = 0xff;
	   row7=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////N


	  //////////////////////N
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row3=0;
	   delay(a);
	   P1 = 0xff;
	   row4=0;
	   delay(a);
	   P1 = 0xff;
	   row5=0;
	   delay(a);
	   P1 = 0xff;
	   row6=0;
	   delay(a);
	   P1 = 0xff;
	   row7=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////N

	   //////////////////////O
	   row3=0;row4=0;row5=0;row6=0;row7=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row3=0;row4=0;row5=0;row6=0;row7=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////O

	   //////////////////////V
	   row2=0;row3=0;row4=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row6=0;
	   delay(a);
	   P1 = 0xff;
	   row7=0;
	   delay(a);
	   P1 = 0xff;
	   row8=0;
	   delay(a);
	   P1 = 0xff;
	   row7=0;
	   delay(a);
	   P1 = 0xff;
	   row6=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////V

	   //////////////////////A
	   row3=0;row4=0;row5=0;row6=0;row7=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row3=0;row4=0;row5=0;row6=0;row7=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////A

	   //////////////////////T
	   row2=0;row3=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////T

	   //////////////////////I
	   row2=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
       delay(a);
	   P1 = 0xff;
	   row2=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////I

	   //////////////////////V
	   row2=0;row3=0;row4=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   row6=0;
	   delay(a);
	   P1 = 0xff;
	   row7=0;
	   delay(a);
	   P1 = 0xff;
	   row8=0;
	   delay(a);
	   P1 = 0xff;
	   row7=0;
	   delay(a);
	   P1 = 0xff;
	   row6=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row3=0;row4=0;row5=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////V


	   //////////////////////E
	   row2=0;row3=0;row4=0;row5=0;row6=0;row7=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   row2=0;row5=0;row8=0;
	   delay(a);
	   P1 = 0xff;
	   delay(a);
	   delay(a);
	   //////////////////////E
	}
}
 

Download C51 from Keil.com.
Setup a project and add your file to the source files.
In the project pane (left panel) select TARGET1. Then select 'project\options for target 'Target1..
select the output tab and check the create hex file box.
specify a name for your hex file.
Close the options panel and press the F7 key.
If there are no errors a hex file will be generated
Good luck
James@CircuitHelp.com
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…