Start where you are. Use what you have. Do what you can.
--Your friends at LectureNotes

Lab Manuals for Microcontroller and Applications - MCA By trupti kulkarni

  • Microcontroller and Applications - MCA
  • Practical
  • Trinity Academy of Engineering, Pune - TAE-Pune
  • Uploaded 2 months ago
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

Department of E&TC Engineering TE E&TC (2015 COURSE) SEM I MICROCONTROLLERS LABORATORY MANUAL By- Mrs. Thite Trupti Ganesh, Trinity Academy of Engineering, Pune

Text from page-2

About the 8051         The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits. All the ICs from a generic model in general are called 8051 because they can all be programmed using 8051 assembly language, and they all share certain features (although the different models all have their own special features). Some of the features that have made the 8051 popular are: 8-bit data bus 16-bit address bus 34 general purpose registers each of 8 bits 16 bit timers (usually 2, but may have more, or less). 3 internal and 2 external interrupts. Bit as well as byte addressable RAM area of 16 bytes. 4 8-bit ports, (short models have 2 8-bit ports). 16-bit program counter and data pointer 8051 models may also have a number of special, model-specific features, such as UARTs, ADC, OpAmps, etc... STEPS TO CREATE AND COMPILE Keil µVision-3/4 PROJECT: 1. Double Click on the  icon on the desktop. 2. Close any previous projects that were opened using – Project -> Close. 3. Start Project – New Project, and select the CPU from the device database (Database-Atmel- AT89C51ED2 or AT89C51RD2 as per the board).On clicking ‘OK’, the following option is displayed. Choose ‘No’. 4. Create a source file (using File->New), type in the assembly or C program and save this (filename.asm/filename.c) and add this source file to the project using either one of the following two methods. (i) Project>Manage->Components, Environment Books->addfiles-> browse to the required file -> OK 1

Text from page-3

“OR” ii) right click on the Source Group in the Project Window and the Add Files to Group option. 5. Build the project; using Project -> Build Project.  application and links. Any errors in the code are indicated by – “Target not created” in the Build window, along with the error line. Debug the errors. After an error free, to build go to Debug mode. 6. Now user can enter into Debug mode with Debug- Start / Stop Debug session dialog. Or by clicking in the icon. 7. The program is run using the Debug-Run command & halted using Debug-Stop Running. Also the (reset, run, halt) icons can be used. Additional icons are (step, step over, and step into, run till cursor). 8. If it is an interface program the outputs can be seen on the LCD, CRO, motor, led status, etc. If it is a part-A program, the appropriate memory window is opened using View -> memory window (for data RAM & XRAM locations), Watch window (for timer program), serial window, etc. 9. Note: To access data RAM area type address as D: 0020h. Similarly to access the DPTR region (XRAM-present on chip) say 9000h location type in X: 09000H. 2

Text from page-4

EXPERIMENT NO: 1 DATE: AIM: Write Assembly Language program of 8051 on Memory transfer. PROBLEM STATEMENT: To write ALP to transfer data from 1.RAM t0 RAM 2.ROM to RAM OBJECTIVE: a. To understand the memory Structure of 8051 Microcontroller. b. To understand the use of KEIL IDE c. To write a simple program in ASSEMBLY LAB REQUIREMENT: Keil IDE THEORY: We can use direct, register indirect and indexed addressing modes to access data stored either in RAM or ROM of the 8051. Direct Addressing Mode This is another way of addressing an operand. Here the address of the data (source data ) is given as operand. Lets take an example. MOV A, 04H Here 04H is the address of register 4 of register bank#0. When this instruction is executed, what ever data is stored in register 04H is moved to accumulator. In the picture below we can see, register 04H holds the data 1FH. So the data 1FH is moved to accumulator. Note: We have not used ‘#’ in direct addressing mode, unlike immediate mode. If we had used ‘#’, the data value 04H would have been transferred to accumulator instead 0f 1FH. Register Indirect Addressing Mode So in this addressing mode, address of the data (source data to transfer) is given in the register operand. MOV A, @R0 Here the value inside R0 is considered as an address, which holds the data to be transferred to accumulator. Example: If R0 holds the value 20H, and we have a data 2F H stored at the address 20H, then the value 2FH will get transferred to accumulator after executing this instruction. Got it? See the picture below. 3

Lecture Notes