embedded c program using 8051

Status
Not open for further replies.

pradeep23

Member level 5
Joined
Aug 20, 2012
Messages
86
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Visit site
Activity points
1,866
i want to write embedded c program to add 16 bit number using 8051 microcontroller someone who help to write the program........
 

what is the problem

unsigned int a=16, b =16;
unsigned long result c =0;
void main(void)
{
c = a+b;
}
 

You have to convert int value to string and then send it to lcd. Do you want the int to string conversion code or LCD Code? If LCD Code. Are you using 8-bit LCD or 4-bit LCD mode?
 

please help for me how to do like that or can you give some example like that to do...
or tell us how to do that program
 

lcd_string() function is an example. You have to change it with your lcd print function.

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
unsigned int op1, op2, result;
unsigned char strres[10];
 
void main(){
 
         result = op1 + op2;
         strres[0] = result/10000 + 48;
         strres[1] = (result/1000)%10 + 48;
         strres[2] = (result/100)%10 + 48;
         strres[3] = (result/10)%10 + 48;
         strres[4] = (result/1)%10 + 48;
         strres[5] = '\0';
         
         lcd_string(strres);
 
}

 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…