BOX patter can be formed using 32 LEDs.
Here 8 LEDs are connected with each PORT of 8051 Micro-controller.
First data is updated on the PORTs so as to form an Outer Box.
Again inner Box is formed by updating suitable data on PORT0, PORT1, PORT2 and PORT3.
To get ongoing box patter formation we need to enclose the whole program in Infinite Loop.
The Output will appear as..
Here is the Code for this.
AGAIN:
MOV P0, #00 //To TURN OFF ALL THE LEDS INITIALLY
MOV P1, #00
MOV P2, #00
MOV P3, #00
MOV P0, #11111111B //Data for Outer Box formation
MOV P1, #10000001B
MOV P2, #10000001B
MOV P3, #11111111B
ACALL DELAY
MOV P0, #00000000B //Data for Inner Box formation
MOV P1, #01111110B
MOV P2, #01111110B
MOV P3, #00000000B
ACALL DELAY
SJMP AGAIN
DELAY: MOV R1, #30
MOV R2, #10
LOOP1: DJNZ R2, LOOP1
DJNZ R1, LOOP1
RET
END


















