#define uint unsigned int
#define uchar unsigned char
sbit cs=P3^0;
sbit wr=P3^1;
void delay(uint z)
{
uchar i;
while(z–)
for(i=0;i<120;i++);
}
void main()
{
uint a;
while(1)
{
P2=a;
cs=0;
wr=1;
wr=0;
a++;
if(a==256)
a=0;
delay(1);
}
}