Tuesday 1 July 2014

8051 Micro Controller & Block Diagram

Block diagram and pin diagram of 8051 micro controller.


Block diagram and pin diagram  of 8051 microcontroller.







ALU: Arithmetic & Logical Unit (ALU) is capable of operating on byte level and bit level.ALU performs arithmetic functions like addition,subtraction,multiplication and division.It is also capable of performing logical functions normally called Boolean functions.

Register A:The register A is also called as accumulator.It is Used for many Operations,particularly mathematical and logical operations,and Boolean bit manipulations.The register A is also used for all data transfers between the 8051 and any external memory.

Register B:The register B is used with the A register for multiplication and division operations and has no other function than data storage.

Program Counter(PC): The 8051 contain a 16-bit register called as Program Counter,which is used to hold the address of a byte in program memory.The PC is automatically incremented after every instruction bye is fetched.The PC is only register that does not have an internal address.

Data Pointer: This Is also 16-bit register,made up of two 8-bit registers,named DPH and DPL.They are used when memory addresses for internal and external code access and extermal data access.DPTR does not have a single internal address;DPH and DPL are each assigned an address.Normally it can be used in lookup table accessing method.




Stack Pointer(SP): Stack is a part of a RAM is used for temporary data storage.SP points only internal RAM of microcontroller.When system is switched ON,SP is initialized to 07H.
PSW: It is also called a Program Status Word.PSW contain flag Registers,which stores 1-bit result of creation program instructions.The 8051 has four math Flags;Carry©,Auxiliary Carry(AC),Overflow(OV) and Parity(P).It is also contains user program flag(F0).
Internal Memory:
They 8051 has two types of memory
4 kb Rom
128 B Ram

Internal RAM:
8051 contains 128 bytes RAM address of RAM is ooh, and 7 Eh

RAM is divided in to three parts:
4 Rag bank ooh to 1Fh
16 bytes bit addressable RAM 20h to 2Fh
Scrath pad RAM

Register Bank :-
8051 has four register bank each bank has 8 register i.e.
    bank 0=Ro to R7
    bank 1= Ro to R7
    bank 2= Ro to R7
    bank 3= Ro to R7

 Port:
In 8051 there are 4 port
Port 0
Port 1
Port 2
Port 3                                                                                                   
                                                                                                                  EA:  The 8051 is access. It is active law 8051 ac. CK ROH are on the chip a time connected to VCC but in 8051 case when it has no internal ROM at that time EA is connected to ground which says that device has internal ROM.
PSEN:  It access an internal ROM connected to Vo but in 8051 case when it has Internal ROM at time EA is connected with signal.
Counter and timers:  Counters are divided into two 8 register called, the timer high & low bytes. All counter action is controlled by bit status is the timer counter reg and contain program instruction.
Interrupts:
When we do program in 8051 all that time work come so there are six interrupts
  • Timer flag interrupt
  • Serial port interrupts
  • Reset
  • Interrupt control
  • Interrupt parity
Flag is cleared to when resulting interrupts generalizes a prong all to the appropriate timers sub.

Serial port interrupt:
                 If a data byte is receiver an bit R is set to 1 in the SCON reg when a data byte has been X’ witted and interrupt it is set in SCON.

External interrupt:
                INT 1 and into are used by external CKT. It can be configured to either X’ mission actionated or the external depending upon value at the units.

Reset: It is gone is reset made by apply to high level to pin no-9 .There reset is done with the help of RC time contact.
-------------------------------------------------------------------------------------------
Article by
--------------
ECE Department
Mother Teresa Institute of science and technology (MIST) 
Mother Teresa Institute of science and technology (MIST)

Stack in C Language

Stack in C Language
A Stack is a linear data structure in which a data item is inserted and deleted at one record. A stack is called a Last In First Out (LIFO) structure. Because the data item inserted last is the data item deleted first from the stack.
Stacks are used most used is system software such as compilers, operating systems, etc.In fact, many compilers store the local variables inside a function on the stack.
Writing a value to the stack is called as a 'Push' operation, where as reading a value from it is called as a 'Pop' operation. A pop operation in stack is destructive. That is, once an item is popped from stack, then it is no longer available.

Simple Program on Stack : 
   
 #include <stdio.h>
    #define Stacksize 5
    void push(int);
    int pop();
    //int getSize();
    int s[Stacksize];
    int top=-1;
    void main()
    {
        int k;
        push (33);
        push (44);
        push (77);
        k=pop();
        printf("\n popped element : %d",k);
        k=pop();
        printf("\n popped element : %d",k);
       
    }
    void push(int ele)
    {
         if(top==(Stacksize-1))
        {
             printf("\n Stack overflow");
             return;
        }
         else
        {
             s[++top]=ele;
        }
    }
    int pop()
    {
         if(top==-1)
        {
             printf("\n Stack underflow");
             return -1;
        }
         else
        {
             return s[top--];
        }
    }
----------------------------------------------------------------------------------------------------
Article by
--------------
CSE Department
Mother Teresa Institute of science and technology (MIST) 



Mother Teresa Institute of Science & technology(MIST), Sathupally

Mother Teresa Institute of science and technology

Mother Teresa Institute of science and technology (MIST), Sathupally is sponsored and managed by MCM Educational Society and was established in the year 2001. Over the years the college has blossomed in to a full-fledged, self-contained  institution, providing technical education of a very high quality, with excellent and adequate infrastructural facilities .The classrooms are airy and spacious, the laboratories have the best available equipment  and the library is abundantly stocked. The buildings provide accommodation in excess of 1,50,000 square foot. The  college is situated in a sprawling, lush green, thirty-acre campus on the outskrits of sathupally. The palatial buildings of the college stand majestically amidst verdant surroundings, rarely found in the hustle and bustle of city life.

Sathupally town is strategically is located on the borders of three districts namely Khammam, West Godavari and Krishna. It falls on the Viskapatnam, Hyderabad State Highway No.7 and can be reached  conveniently by road from Vijayawada(110Km), Eluru(80km) and Khammam(80Km). A number of Buses fly from Hyderabad to Sathupally via Khammam on way to Rajmundhry, Kakinada, Eluru, Amalapuram and Jangareddygudem. From Vijayawada  there are express buses  to Sathupally every hour from 5am to 10 pm.

Mother Teresa Institute of Science & Technology,Sathupally
Mother Teresa Institute of Science & Technology,Sathupally