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.
i don't what is my mistake i am new to embedded c ,please help me
my code is:
#include <reg51.h> #include <stdio.h> extern unsigned int getnumber (void); extern void output (unsigned int);
void main (void) { unsigned int number1, number2; bit operation; SCON = 0x50; TMOD = 0x20; TR1 = 1; T1 = 1; TH1 = 221; printf ("hi yuvaraj");
while (1) { number1 = getnumber (); number2 = getnumber (); printf ("Input operation: '+' (ADD) or '-' (SUB) ? "); operation = (getchar () == '+'); /* get operation */ output (operation ? (number1 + number2) /* perform operation */ : (number1 - number2) ); } }
Your first mistake is that you are not paying attention to instructions that are clearly presented before your very eyes!
See: http://www.keil.com/forum/docs/thread13545.asp
Attention to detail is absolutely fundamental to any kind of programming - especially embedded programming!