You are on page 1of 1

#include <at89x51.

h>
void feel1ms( )
{
int i;
for(i=0;i<150;i++);
}

void feel(int n)
{
int i;
for(i=0;i<n;i++)
feel1ms( );
}

void main( )
{
volatile unsigned char a=0x01;
while(1)
{
a=((a>>7)|(a<<1));
feel(1000);
P0=a;
}
}

===================assembly code===============================

$mod51
ORG 00H
LOOP: MOV A, #0FEH
MOV R2, #8
OUTPUT: MOV P0, A
RL A
ACALL DELAY
DJNZ R2, OUTPUT
LJMP LOOP
DELAY: MOV R6, #0
MOV R7, #0
DELAYLOOP:
DJNZ R6, DELAYLOOP
DJNZ R7, DELAYLOOP
RETI
END

You might also like