Code:
#include <REGX51.H>
#include<delay.h>
void framescaning(unsigned char,int);
void framescaning(unsigned char k,int m)
{
unsigned char b[] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
P2 = b[m];
P0 = ~k;
delay(1); }
void main()
{
P1 =0x00;
P0 =0x00;
P2_0 = 0x00;
while(1)
{
unsigned int n,z=0;
unsigned char i=0;
unsigned char a[] = {0x18,0x24,0x20,0x18,0x04,0x04,0x38,0x00};
for (n=0; n<8; n++)
{
framescaning( a[n] ,z );
z++;
} } }