Write an 8051 C program to send values of -4 to 4 to port P1.

By

Write an 8051 C program to send values of -4 to 4 to port P1.



Solution:
#include <reg51.h>
void main(void)
{
  char mynum[]={+1,-1,+2,-2,+3,-3,+4,-4};
  unsigned char z;
  for (z=0; z<8; z++) 
    P1=mynum[z];  
}

0 comments:

Post a Comment

If you have any questions or droughts feel free to ask here.