#include <STC15.H>
sbit CKEN1 =P1^0;
sbit CKEN2 =P1^1;
sbit CLK =P1^2;
void Delay(unsigned int i)
{
unsigned char j;
while(i)
{
i--;
for (j=255;j>0;j--)
{
}
}
}
void a(unsigned char red)
{
P0=red;
CKEN2 = 0;
CLK = 0;
CLK = 1;
CKEN2 = 1;
P0= 0xff;
}
void b(unsigned char red)
{
P0=red;
CKEN1 = 0;
CLK = 0;
CLK = 1;
CKEN1 = 1;
P0= 0xff;
}
void main()
{
//unsigned char i,j;
P0M0 = 0XFF;P0M1 = 0;
P1M0 = 0XFF;P1M1 = 0;
while (1)
{
b(0xff);
a(0xff);
Delay(1000);
a(0xaa);
b(0x55);
Delay(1000);
b(0xff);
a(0xff);
Delay(1000);
a(0x55);
b(0xaa);
Delay(1000);
b(0xff);
a(0xff);
Delay(1000);
a(0);
b(0);
Delay(1000);
}
}
|