We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi friends am new to embedded C.......
i am tring to write program for adding of two numbers.... But i don't get the result.........
My code is
#include <reg51.h> /* define 8051 registers */ #include <stdio.h> /* define I/O functions */
extern unsigned int getnumber (void); extern void output (unsigned int);
void main (void) { /* main program */ unsigned int number1, number2; /* define operation registers */ bit operation; /* define operation */
SCON = 0x50; /* SCON */ /* setup serial port control */ TMOD = 0x20; /* TMOD */ /* hardware (2400 BAUD @12MHZ) */ TR1 = 1; T1 = 1; /* TCON */ TH1 = 221; /* TH1 */
printf ("hi yuvaraj");
while (1) { /* repeat forever */ number1 = getnumber (); /* read number1 */ number2 = getnumber (); /* read number2 */ printf ("Input operation: '+' (ADD) or '-' (SUB) ? "); operation = (getchar () == '+'); /* get operation */ output (operation ? (number1 + number2) /* perform operation */ : (number1 - number2) ); } }
please help me to get result..... advance thanks for yr solutions
Please read the instructions on how to post source code: www.danlhenry.com/.../keil_code.png
Don't manually re-type the code into the post - use only copy-and-paste;
Note that TABs don't work (well) - use spaces instead,
and don't forget to check it in the 'Preview'...