Write an 8051 C program to send hex values for ASCII characters of 0,1,2,3,4,5,A,B,C, and D to port P1.
Solution:
#include <reg51.h>
void main(void){
unsigned char mynum[]=“012345ABCD”;
unsigned char z;
for (z=0; z<10; z++)
P1=mynum[z];
}
#include <reg51.h>
void main(void){
unsigned char mynum[]=“012345ABCD”;
unsigned char z;
for (z=0; z<10; z++)
P1=mynum[z];
}
Note: “012345ABCD” is stored in RAM and can be changed
Write an 8051 C program to send hex values for ASCII characters
0 comments:
Post a Comment
If you have any questions or droughts feel free to ask here.