logo

Select Sidearea

Populate the sidearea with useful widgets. Itโ€™s simple to add images, categories, latest post, social media icon links, tag clouds, and more.
[email protected]
+1234567890
 

Summing Port 0 and Port 1 with C Programming

image

 

/************************************           **           ** A program to get familer with SDCC           **           ** This program will read port 0 and port 1           ** and will add the their contents. Then it checks           ** whether the result is greater than 127 or not. If it is           ** greater than 127 then the addition result would be           ** put to port 3 else to port 2.            ** Compiler : MIDE-51*************************************/
#include <8051.h>
void main(void)           {           unsigned char a, b, c;
 a=P0;           b=P1;           c=a+b;
 if (c<127)           P2=c;           else           P3=c;
 return;           }