第16步程序一:
#include<reg52.h>
#define X P0 // 定义 X.Y.Z 三个坐标轴
#define Y P1
#define Z P2
#define N 65000 //延时参数N
void delay(void);
void Diagram(unsigned int x,unsigned int y,unsigned z);
void main()
{
X=0x0f;
Y=0x00;
Z=0x0f;
delay();
while(1)
{
Diagram(9,6,9); //----------------点(1,1,1)
Diagram(5,10,5);
Diagram(3,12,3);
Diagram(1,14,1);
Diagram(3,12,3);
Diagram(5,10,5);
Diagram(9,6,9);
Diagram(5,10,5);
Diagram(3,12,3);
Diagram(1,14,1);
Diagram(3,12,3);
Diagram(5,10,5);
Diagram(9,6,9); //---------------点(4,1,1)
Diagram(10,10,5);
Diagram(12,12,3);
Diagram(8,14,1);
Diagram(12,12,3);
Diagram(10,10,5);
Diagram(9,6,9);
Diagram(10,10,5);
Diagram(12,12,3);
Diagram(8,14,1);
Diagram(12,12,3);
Diagram(10,10,5);
Diagram(9,6,9); //---------------点(1,4,1)
Diagram(5,5,5);
Diagram(3,3,3);
Diagram(1,7,1);
Diagram(3,3,3);
Diagram(5,5,5);
Diagram(9,6,9);
Diagram(5,5,5);
Diagram(3,3,3);
Diagram(1,7,1);
Diagram(3,3,3);
Diagram(5,5,5);
Diagram(9,6,9); //-----------点(4,4,1)
Diagram(10,5,5);
Diagram(12,3,3);
Diagram(8,7,1);
Diagram(12,3,3);
Diagram(10,5,5);
Diagram(9,6,9);
Diagram(10,5,5);
Diagram(12,3,3);
Diagram(8,7,1);
Diagram(12,3,3);
Diagram(10,5,5);
Diagram(9,6,9); //----------------点(1,1,4)
Diagram(5,10,10);
Diagram(3,12,12);
Diagram(1,14,8);
Diagram(3,12,12);
Diagram(5,10,10);
Diagram(9,6,9);
Diagram(5,10,10);
Diagram(3,12,12);
Diagram(1,14,8);
Diagram(3,12,12);
Diagram(5,10,10);
//----------------点(4,1,4)
Diagram(9,6,9);
Diagram(10,10,10);
Diagram(12,12,12);
Diagram(8,14,8);
Diagram(12,12,12);
Diagram(10,10,10);
Diagram(9,6,9);
Diagram(10,10,10);
Diagram(12,12,12);
Diagram(8,14,8);
Diagram(12,12,12);
Diagram(10,10,10);
//----------------点(1,4,4)
Diagram(9,6,9);
Diagram(5,5,10);
Diagram(3,3,12);
Diagram(1,7,8);
Diagram(3,3,12);
Diagram(5,5,10);
Diagram(9,6,9);
Diagram(5,5,10);
Diagram(3,3,12);
Diagram(1,7,8);
Diagram(3,3,12);
Diagram(5,5,10);
//----------------点(4,4,4)
Diagram(9,6,9);
Diagram(10,5,10);
Diagram(12,3,12);
Diagram(8,7,8);
Diagram(12,3,12);
Diagram(10,5,10);
Diagram(9,6,9);
Diagram(10,5,10);
Diagram(12,3,12);
Diagram(8,7,8);
Diagram(12,3,12);
Diagram(10,5,10);
}
}
void delay(void)
{ unsigned int n;
n=N;
while(n--);
}
void Diagram(unsigned int x,unsigned int y,unsigned z)
{
X=x;
Y=y;
Z=z;
delay();
}
/*
*******************仅有Z轴在变化****************
void main()
{
X=0x0f;
Y=0x00;
Z=0x0f;
delay(500);
while(1)
{ Z--;
delay(50000);
if(Z==0)
{Z=0x0f;}
}
///-------------
X=0x0f;
Y=0x00;
Z=0x0f;
delay();
while(1)
{ Z--;
Y++;
X--;
delay();
if(Z==0)
{Z=0x0f;}
if(Y==0x00)
{Z=0x0f;}
if(X==0)
{Z=0x0f;}
}
}
*/
评 论
选择昵称后请轻按空格键
请勿进行人身攻击,谩骂以及任何违法国家相关法律法规的言论。