Tuesday, 20 February 2018

Wednesday, 23 November 2016

Forming BOX PATTERN using 32 LEDs with AT89S52 in Assembly_ Best Embedded Tutorial

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

Shifting LEDs Pattern with AT89S52 in Assembly _ Best Embedded Tutorial

Shifting Effect can be formed on LEDs by just turning each LED individually with remaining Off for the meanwhile.
Here is the simple code for forming such shifting pattern.



MOV A, #10000000B
     AGAIN:RR A
MOV P2, A
ACALL DELAY
SJMP AGAIN
DELAY:                                        //Program for delay
 MOV  R1, #10
 MOV  R2, #10
 MOV  R3, #2
LOOP1: DJNZ R3, LOOP1
               DJNZ R2, Y2
               DJNZ R1, Y3
RET
END

/*You may program in simple way if you find the first one messy
AGAIN:
MOV P2,#10000000B
ACALL DELAY
MOV P2,#01000000B
ACALL DELAY
MOV P2,#00100000B
ACALL DELAY
MOV P2,#00010000B
ACALL DELAY
MOV P2,#00001000B
ACALL DELAY
MOV P2,#00000100B
ACALL DELAY
MOV P2,#00000010B
ACALL DELAY
MOV P2,#00000001B
ACALL DELAY
SJMP AGAIN

DELAY:                                        //Program for delay
 MOV  R1, #10
 MOV  R2, #10
 MOV  R3, #2
LOOP1: DJNZ R3, LOOP1
               DJNZ R2, Y2
               DJNZ R1, Y3
RET
END
                                        Both programs will have same output
*/

Blinking LEDs in Finite loop with AT89S52 in Assembly_ Best Embedded Tutorial

So here is the Code for Blinking LEDs for finite times.
The concept of finite loop is used here. Let us see how to form such a loop in Assembly.





MOV R6, #8                                 //R6 value should be = Loop count
AGAIN: MOV P2, #11111111B    //Turn On all the LEDs
    ACALL DELAY                         //ADD Delay
    MOV P2, #00000000B               //Turn Off all the LEDs
    ACALL DELAY                        //ADD Delay again
    DJNZ R6, X1                            //
HERE:SJMP HERE                     //To stop blinking after 8 times

DELAY:                                        //Program for delay
 MOV  R1, #10
 MOV  R2, #10
 MOV  R3, #2
LOOP1: DJNZ R3, LOOP1
               DJNZ R2, Y2
               DJNZ R1, Y3
RET
END

Tuesday, 22 November 2016

Blinking LEDs with AT89S52 in ASSEMBLY_ Best Embedded Tutorial

Here is the ASSEMBLY CODE for blinking LEDs for INFINITE TIMES. 
8 LEDs are connected with PORT2
____________________________________________________________

CONTINUE:
MOV P2,#0FFH   //TO TURN ON ALL THE LEDS
ACALL DELAY   //ADDING DELAY FOR SOMETIME
MOV P2,#00H    //TO TURN OFF ALL THE LEDS
ACALL DELAY   //ADDING DELAY FOR SOMETIME
SJMP CONTINUE   //FORMING INFINITE LOOP

DELAY:                            //PROGRAM FOR DELAY
MOV R0,#10
MOV R1,#10
MOV R2,#10
LOOP1:DJNZ R2,LOOP1
             DJNZ R1,LOOP1
             DJNZ R0,LOOP1
RET                                       //RETURN DIRECTIVE
END                                        //END DIRECTIVE

_______________________________________________________________
Here is the O/P of this Program


Connection Modes of LEDs Common Cathode(C.C) & Common Anode(C.A)_ Best Embedded Tutorial

To glow an LED we needs to connected it in Forward Bias Condition. 




When we have so many LEDs to connect, then we have two choices for their connection.
1.)Common Cathode Connection Mode (C.C)
     In this mode, all the cathode terminals of LEDs are connected together and finally they are                  grounded.
     Anode terminal may be provided with Higher Digital Logic '1' or Digital Logic Low '0'
     Providing 1 to Anode will put the LED in forward bias Condition thus it will glow.
     Providing 0 to Anode will put the LED in reverse bias Condition thus it will remain OFF.

2.)Common Anode Connection Mode (C.A)
     In this mode, all the Anode terminals of LEDs are joined together and finally they are                  
     connected to V
     Cathode terminal may be provided with Higher Digital Logic '1' or Digital Logic Low '0'
     Providing 1 to Cathode will put the LED in reverse bias Condition thus it will remain OFF.
     Providing 0 to Cathode will put the LED in forward bias Condition thus it will turn ON.



An Introduction to Embedded System_ Best Embedded Tutorial


A system may be regarded as Embedded if it contains Hardware along with Software into it.
Each embedded system is governed by the Program which is embedded into its hardware.
Suppose we have a hardware and we frequently change programs into it then the system's functioning will get changed each time. 

Thus a single programmable Hardware can be instructed to perform different Operations just by changing its program.If we instruct a hardware by simple program/s to perform a certain task, we call that system as Embedded System.Embedded system in most simple words, 
"A system in which Software is Embedded into the Hardware." 




Hardware includes various Circuit elements such as Diode, EMF Source, Transistors, ICs etc.

And Software mainly involves Programming part.

Hardware and Software, these two are building blocks of an Embedded System.