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];
}
All About 8051 Microcontroller.Learn all basics of Microcontrollers and Embedded Systems.
Subscribe to our newsletter to get the latest updates to your inbox. ;-)
Your email address is safe with us!
© 2015 8051 Microcontroller. Designed by Bassar Patel
#include
ReplyDeletevoid main(void)
{
char mynum[]={+1,-1,+2,-2,+3,-3,+4,-4};
unsigned char z;
for (z=0; z<8; z++)
P1=mynum[z];
}