#include<reg51.h>
#include<string.h>
struct //自定义结构体
{
int P1;
char SW;
char strs[20];
}pk;
void main()
{
if(pk.SW == 1)
pk.P1 = 0x01;
strcpy(pk.strs,"are you OK");
delay(200);
if(pk.SW == 2)
pk.P1 = 0x02;
strcpy(pk.strs,"this is struct");
delay(200);
//.....................
while(1);
}
//按键SW 自己设,延时做一做,点到为止!
|