#include "mb95200.h"
void Init (void)
{
DDR0_P06=1; //red
PDR0_P06=0;
DDR6_P62=1; //green
PDR6_P62=0;
DDR6_P63=1; //blue
PDR6_P63=0;
}
void wplay (unsigned int r, unsigned int g, unsigned int b)
{
unsigned int i;
PDR0_P06=r>4?0:1;
PDR6_P62=g>4?0:1;
PDR6_P63=b>4?0:1;
for(i=0;i<20;i++) asm("\tNOP");
}
void splay (unsigned int r, unsigned int g, unsigned int b)
{
unsigned int x,y,z,w;
x=r+4;
y=g+4;
z=b+4;
w=4;
while(w>0)
{
wplay(x,y,z);
x--; y--; z--;
w--;
}
}
void dplay (unsigned int j)
{
unsigned int i;
PDR0_P06=1;
PDR6_P62=1;
PDR6_P63=1;
for(i=0;i<j;i++) asm("\tNOP");
}
void pplay (unsigned int r, unsigned int g, unsigned int b)
{
unsigned int i;
for(i=0;i<100;i++) splay(r,g,b);
dplay(5000);
}
void main (void)
{
Init ();
while(1)
{
pplay(2,1,1); //1 brown
pplay(4,0,0); //2 red
pplay(4,2,0); //3 orange
pplay(4,4,0); //4 yellow
pplay(0,4,0); //5 green
pplay(0,0,4); //6 blue
pplay(2,1,3); //7 purple
pplay(2,2,2); //8 gray
pplay(4,4,4); //9 white
pplay(0,0,0); //0 black
}
}