Basic Embedded C Programs Lab Manual
Basic Embedded C Programs Lab Manual
A. SIMPLE PROGRAM
B. ARITHMETIC OPERATORS
2. Simple Addition program
#include<reg51.h> //header file
void main() //main function
{
int a,b,c; //declare some variable using_ integer data_ type
a=0x01; //assign value
b=0x02; //assign value
c=a+b; //add both a and b values
P1=c; //show the addition value to port 1
}
}
}
b=3;
}
case 2:
P1=0x02;
break;
D. BITWISE OPERATORS
26. Simple AND operation program