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.

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
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;
}
 

how can we show the output in keil3 ?
 

may uart is better or lcd also ok how can i show that ....
 

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);
 
}

 

google saeedblogspot (a very nice blog from saeed yasin)u wll find many pic and 8051 example
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top