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];  
}

1 comment:

  1. #include
    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];
    }

    ReplyDelete

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