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.

ask about programming uvision at the video TISHITU Part 3/3 of 8051 microcontrolled

Status
Not open for further replies.

Rizky20

Newbie level 4
Joined
Jun 24, 2014
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
84
i have watching this video (https://www.youtube.com/watch?v=05imB2OFlVI) , but this video don't tell me about programming device (AT89C51). can someone tell me about the step for make its hex file on keil uvision (4) ? :smile:

this is its code :

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#include<reg51.h>                                                    // header file
sbit p=P3^0;                                                                 // to increase hours
sbit q=P3^1;                                                                 // to decrease minutes
sbit r=P3^2;                                                                 // to decrease hours
sbit l=P3^4;                                                                // to buzzer to indicate hour
sbit bu=P3^3;                                                             // to increase minutes
sbit t=P3^5;                                                                  // to increase date
sbit u=P3^6;                                                               // to decrease date
sbit w=P3^7;                                                              // to increase month
sbit rs=P2^1;                                                              // LCD command pin for select the resistor inside the lcd
sbit rw=P2^2;                                                           // LCD command pin for write the information on lcd
sbit en=P2^3;                                                      // LCD command pin used to latch information presented to it’s data pins
sfr lcddata=0×90; // P2= LCD data pin
/************************************DELAY FUNCTION************************************************/
void delay(unsigned char n)
{
unsigned char i,j;
for(i=0;i<n;i++)
for(j=0;j<125;j++);
 
}
/*********************************LCD COMMAND FUNCTION********************************************/
 
void command(unsigned char s)
{
lcddata=s;                                                                        //put the value on pin
rs=0;
rw=0;
en=1;                                                                                 //strobe the enable pin
delay(40);
en=0;
}
/***************************************LCD DISPLAY FUNCTION****************************************/
 
void lcddisplaydata(unsigned char s)
{
lcddata=s;                                                              //put the value on pin
rs=1;
rw=0;
en=1; //strobe the enable pin
delay(40);
en=0;
}
/***************************************MAIN program************************************************/
 
void main()
{
int h,m,s,y,mo,d,y1,y2,y3,y4,mo1,mo2,d1,d2,h1,h2,m1,m2,s1,s2,i,j,k;
unsigned char array[]={0,1,2,3,4,5,6,7,8,9};
command(0×38);                              // LCD command code for 2 lines and 5*7 matrix
command(0x0c);
command(0×06);                                // LCD command code for increment cursors(shift cursor to right)
while(1)
{
y=2012;                                                 //starting from year 2012
while(y>=2012)
{
for(mo=1;mo<=12;mo++)
{
if(mo==1)                                                //condition for month january
{
d=31;
}
else if(mo==2)                                          //condition for month february
{
if((y%4)==0)                                              //condition for leap year
{
d=29;
}
else
{
d=28;
}
}
else if(mo==3)                                                //condition for month march
{
d=31;
}
else if(mo==4)                                                 //condition for month april
{
d=30;
}
else if(mo==5)                                                    //condition for month may
{
d=31;
}
else if(mo==6)                                                  //condition for month june
{
d=30;
}
else if(mo==7)                                                      //condition for month july
{
d=31;
}
else if(mo==8)                                                       //condition for month august
{
d=31;
}
else if(mo==9)                                                     //condition for month september
{
d=30;
}
else if(mo==10)                                                 //condition for month october
{
d=31;
}
else if(mo==11)                                                  //condition for month november
{
d=30;
}
else                                                                          //condition for month december
{
d=31;
}
for(i=1;i<=d;i++)
{
for(h=0;h<=23;h++)                                                           //condition for hours in a day
{
for(m=0;m<=59;m++)                                                     //condition for minutes in a hour
{
for(s=0;s<=59;s++)                                                          //condition for second in minute
{
y1=y/1000;
j=y%1000;                                                                              //code for disply year
y2=j/100;
k=j%100;
y3=k/10;
y4=k%10;
mo1=mo/10;                                                                             //code for display month
mo2=mo%10;
d1=i/10;
d2=i%10;                                                                                 //code for display day
h1=h/10;
h2=h%10;                                                                                // code for display hour
m1=m/10;                                                                              //code for display minute
m2=m%10 ;
s1=s/10;                                                                                     //code for disply second
s2=s%10;
command(0×80);                                                                // LCD command for first position of first line
lcddisplaydata(array[d1]);
lcddisplaydata(array[d2]);
command(0×84);                                                                // LCD command for fifth position of first line
lcddisplaydata(-);
command(0×86);                                                               // LCD command for seventh position of first line
lcddisplaydata(array[mo1]);
lcddisplaydata(array[mo2]);
command(0×89);                                                              // LCD command for tenth position of first line
lcddisplaydata(-);
command(0x8b);                                                             // LCD command for twelveth position of first line
lcddisplaydata(array[y1]);
lcddisplaydata(array[y2]);
lcddisplaydata(array[y3]);
lcddisplaydata(array[y4]);
 
command(0xc0);                                                                // LCD command for first position of second line
lcddisplaydata(array[h1]);
lcddisplaydata(array[h2]);
command(0xc4);                                                               // LCD command for fourth position of second line
lcddisplaydata(:);
command(0xc6);                                                               // LCD command for sixth position of second line
lcddisplaydata(array[m1]);
lcddisplaydata(array[m2]);
command(0xca);                                                                  // LCD command for eleventh position of second line
lcddisplaydata(:);
command(0xcc);                                                                // LCD command for thirteenth position of second line
lcddisplaydata(array[s1]);
lcddisplaydata(array[s2]);
delay(100);
if(p==0)                                                                                       // switch for increasing Hours
{
h++;                                                                                          // condition to set hours
s=-1;                                                                                          // second reset to Zero after release H++ switch
if(h==24)                                                                                    // if h=24 then hours is start to Zero
{
h=0;
s=-1;
}
}
else if(q==0)                                                                        // switch for decreasing Minutes
{
if(m>0)                                                                                          // if minute is greater then zero
{
m–;                                                                                                              // minute is decrease till zero
s=-1 ;                                                                                                   // after releasing minute decrease button seconds initialize from zero
}
}
else if(r==0)                                                                         // switch for decreasing hours
{
if(h>0)                                                                                            // if hour is greater than zero
{
h–;                                                                                              // hour is decrease till zero
s=-1;                                                                                             // after releasing hour decrease button seconds initialize from zero
}
}
else if(l==0)                                                                              // switch for increasing minutes
{
m++;
s=-1;
if(m>60)                                                                                     // if increased minutes are above than 60 than it again start from zero
{
m=0;
s=-1;
}
}
else if(t==0)                                                                                   // switch for increasing days
{
i++;
if(i>31)                                                                                                 // if increased days are above than 31 than it again start from zero
{
i=0;
}
}
else if(u==0)                                                                                         // switch for decreasing days
{
if(i>0)                                                                                                     // it decrease days till zero
{
i–;
}
}
else if(w==0)                                                                                   // switch for increasing months
{
mo++;
if(mo>12)                                                                                    // if increased months are above than 12 than it again start from zero
{
mo=0;
}
}
else
{
h=h;
m=m;
i=i;
mo=mo;
}
if(m==59)                                                                           // conditin for switching the buzzer
{
bu=1;                                                                                      // buzzer ON
}
else
{
bu=0;                                                                                 // buzzer OFF
}
command(0×82);                                                         // to start LCD from 3rd position of first line
command(0×06);                                                            // to set LCD in entry mode
}
}
}
}
}
}
}
}

 
Last edited by a moderator:

Re: programming keil at the video TISHITU Part 3/3 of 8051 microcontroller

click the Project--options for target...--out put,you should check the "Create HEX file",and then rebuild your target,you will find the hex file in you project folder!
 

when I click rebuild, error massage appear:
"Rebuild targets 'Jamdigital'
The target has no object modules
Target not created"......
How to fix it?:)
 
Last edited:

you create a file,but you didn't add the file to the project!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top