You are on page 1of 10

THE OPEN UNIVERSITY OF SRI LANKA

Faculty of Engineering Technology Department of Electrical and Computer Engineering Diploma in Technology Level 04

Course Information and Tutor Marked Assignments (2011/2012) ECX4236 Microprocessors and Interfacing
Target Group: Students who are readying for the Diploma in Engineering Technology Aims and Objectives: This course provides the background knowledge necessary to build interfaces to a simple microprocessor based system. After studying this course, you are expected to achieve the following: Be able to identify the programming model of a microprocessor/ microcontroller. Ability to use the Instruction Set Architecture (ISA) to perform o Arithmetic / Logic Operations. o Data / Control Transfer Operations. o Input / output Operations. Describe the role of a computer simulator in program development and the ability to use such a simulator. Describe the purpose and use the following basic components of the 8051 architecture. o Special Function Registers (SFR) o Register Banks o Interrupts o Timers / Counters o Serial Communication Ability to write programs in assembly language to perform a particular task using a microprocessor / microcontroller. Know the difference between a microprocessor and a microcontroller. Know the different types of applications for which microcontrollers are used. Ability to use basic interfacing techniques to connect the microcontroller to the outside world. Basic knowledge about the ASIC and HDL. Prerequisites: The prerequisite for this course is as listed in the Student Guide Book.

1 ECX4236 Microprocessors and Interfacing

Course Components: At the time of registration, you should receive the following: ECX4236 Microprocessors and Interfacing Laboratory Experiment Book. ECX4236 Supplementary Notes This course does not have a predefined set of lessons as such, and you are expected to search and find the relevant materials in the library and on the internet. Three home-based Tutor Marked Assignments (TMAs) will direct such reading. You are required to prepare three home TMAs. These should be prepared individually although you are encouraged to form discussion groups and discuss the issues among yourselves whenever possible. Plagiarism (that is, presenting others work as your own) will not be tolerated, and will be reflected in the grade of all parties involved. For each assignment, a viva voce examination will be held during laboratory classes. There will be one CAT (Continuous Assessment Test). The CAT will be OPEN BOOK type, where you are allowed to refer any materials during the test. There are seven activities in this course. Three TMAs Three Lab Sessions One CAT Eligibility: Best six of the seven activities will be considered towards the continuous assessment mark. CA Final = Average Best 6 of (3 TMA, 3 lab sessions, 1 CAT) Lab Average = average of (3 lab sessions) Eligibility = CA Final 40% AND Lab Average 40% Final Examination: There will be a three hour CLOSED BOOK type test at which you are not allowed any reference materials. Day Schools: There will be five day schools. Please attend the first day school without fail. The first day school will be held on 28h of May 2011 from 0900 to 1130hrs at the Colombo Regional Centre. Laboratory: At the time of registration, you are supposed to assign yourself to a particular lab group. If you are not assigned to a group yet, feel free to contact the course coordinator and get a group. When you come to the LAB, you should bring the soft copy of the ALP (Assembly Language Program) that you have written for each TMA. 2 ECX4236 Microprocessors and Interfacing

Recommended Readings: What Every Engineer should know about Micro-Computers Hardware/Software Design a Step-by-step Example (William S. Bennett and Carl F. Evert, Jr.) The 8051 Microcontroller and Embedded SystemUsing Assembly and C Second Edition Prentice-Hall India (Muhammed Ali Mazidi, JuniceGillispieMazidi, Rolin D. Mckinlay) Embedded Systems & Robots:Projects Using The 8051 Microcontroller SubrataGhoshal

Contacts: S-mail: The Course Coordinator ECX4236 Microprocessors and Interfacing Department of Electrical and Computer Engineering The Open University of Sri Lanka P.O. Box 21, Nawala, Nugegoda. Sri Lanka. cjbas@ou.ac.lk +94 11 288 1437

E-mail: Phone: -

3 ECX4236 Microprocessors and Interfacing

Tutor Marked Assignment #1 2011


Use the ASM51 Assembler and the 8052 simulator to verify your ALP. Submit your written assignment on or before 01st of July 2011 and late submissions will not be accepted! You should be prepared to face a viva voce examination based on TMA#1, during the first laboratory session.

[Q1] (a) How would you explain the process of writing an Assembly Language Program (ALP), the compilation using ASM51 compiler, simulation using 8052 simulator and the generating the files for a beginner who is going to use an 8051 microcontroller? Explain using screenshots of the processes. (b) A student has written a simple ALP program and has compiled it using ASM51 compiler. A part of the generated .LST file is shown below in Figure 1. Briefly explain each part of the code segments circled?

Figure 1 (c) Calculate the no. of machine cycles has been consumed in executing the written program. (d) Assume that currently the processor executes the instruction resides in the memory location 0003H. Explain the process of executing the next instruction resided in 0005H. You are expected to discuss the change of the contents of the Program Counter and the fetch and execute cycles. [Q2] (a) Draw a simple block diagram by specifying the available types of memory in 8051 microcontroller and clearly mention the area belongs to each type of memory. (b) What is the difference between each type of memory and write down sample codes to access each memory segment? (c) Write a simple ALP to store the values of the array shown below in a stack and retrieve the value which is equal to 05H. 5, 10,20,15,16 (d) What is the mechanism used to identify the register bank is being addressed at a particular time from the available four register banks? 4 ECX4236 Microprocessors and Interfacing

Tutor Marked Assignment #1 2011


[Q3] (a) Consider the first two digits of your Registration No in microseconds (S) and write simple ALP codes to implement the delay using all the supportive timing modes in 8051. E.g. 70460940 => 70 S (b) Draw a circuit diagram to interface a DIP switch in to Port 1 and eight LEDs to Port 2 in 8051 microprocessor. Write a simple ALP to lighten the LEDs connected to Port 2 according to the selection of DIP switches. . (c) Assume that the output of a frequency generator is connected to the INT0 pin of 8051 microcontroller. Write a simple ALP to count the no. of pulses entered during the period as per in part (a) of the same question. Select the counter mode according to the first digit of your registration no. First digit of your registration number Counter Mode 1,2 3,4 5,6 7 0 1 2 3

(d) Draw a diagram and describe the process of counting the number of the occurrences of a particular event in counter mode used above in part (d).

[Q4] Assume that you have asked to design a practical model for the students who are studying microprocessor and interfacing. You are allowed to select any component from the following, A LCD, Two seven segments displays, DIP Switch, two DC Motors, two Stepper motors, LEDs and/or any other electronic components. Make sure that it is compulsory to use one of the given motor types. (a) (b) (c) (d) (e) Draw a block diagram of your design. Describe your design using a flow chart and mention the assumptions that you made. Draw a schematic diagram of your design. Prepare a complete list of components that you are expecting with a short description. What are the motives that the student would be able to gain by using your practical model?

5 ECX4236 Microprocessors and Interfacing

Tutor Marked Assignment #2 2011


Use the ASM51 Assembler and the 8052 simulator to verify your ALP. Submit your written assignment on or before 26th of August2011and late submissions will not be accepted! You should be prepared to face a viva voce examination based on TMA#2, during the second laboratory session.

[Q1] (a) What are the available types of Stepper motors? (b) How to determine the direction of rotation in a Stepper motor? (c) Assume that you have provided a four wire lead, permanent magnet stepper motor which the step angle is 1.8 degrees. Design a small apparatus to rotate the stepper motor clockwise, anticlockwise and to measure the RPM after pressing correspondent switches and draw the connection diagram of your apparatus. (d) Explain about the interfacing devices that you have used in your design. (e) Write a small ALP of your design. No of steps require to rotate one complete rotation = 360 deg. / step angle in deg. The relation between RPM and steps per sec. is given by, Steps or impulses /sec. = (RPM X Steps /revolution) /60 [Q2] There is a push button connected to the pin 2 of Port 2 (P2.2) and there is a corresponding LED connected to pin 0 of Port 0 (P0.0). (a) Write a simple ALP to glow the LED once the push button is pressed. (b) Draw the circuit diagram by considering the necessary changes to be done in order to use interrupts and re-write the ALP using external hardware interrupts. (c) What are the advantages of using interrupts over poling method? You are expected to answer by considering the scenario given above. (d) Assume that you have connected an extra LED to pin 1 of Port 0 (P0.1) and have written the ALP to automatically toggle the LED every time when the Timer1 overflows. What will be the contents of the IE register that you require to assign? Justify your answer. (e) How do you prevent the confusion that could happen with simultaneous interrupt occurring? (f) What happens if an interrupt occurs? You are expected to describe by specifying the change of the contents of the Stack Pointer.

6 ECX4236 Microprocessors and Interfacing

Tutor Marked Assignment #2 2011


[Q3] (a) What is the mechanism used to synchronize the receiver with the transmitter in the Universal Asynchronous Receiver Transmitter (UARTs) in 8051? (b) Assume that there are two 8051 based systems which are X and Y interfaced serially. Draw a block diagram by showing the connections. (c) If the baud rate of X and Y is equal to 9600pbs, 8 data bits, 1 start bit, 1 stop bit and no parity bits. Find out the timer values. (d) If X wishes to send 5 bytes stored in a look up table to system Y, What will be the sequence of events in the two systems? (e) Assume that you are expected to interface a PC with one of the above two systems through serial port. What will be the connection diagram? (f) Write a simple test program that will "loop test" the serial port.

[Q4] (a) You are expected to search the internet and find the suitable devices (sensors/transducers or actuators) need to be interfaced with 8051 for the following. Justify your answers. I. To detect whether it is morning or not II. To measure the RPM of a DC motor III. To check whether the soil is dry or not IV. To check whether there is an obstacle within a certain area or not (b) List down the model, measurement range can be made and the type of the output signal of the devices mentioned above in part (a) (c) Draw simple block diagrams to depict the way of interfacing the sensors or the actuators mentioned above in part (a) with 8051

7 ECX4236 Microprocessors and Interfacing

Tutor Marked Assignment #3 2011


Use the ASM51 Assembler and the 8052 simulator to verify your ALP. Submit your written assignment on or before 28th of November 2011 and late submissions will not be accepted! You should be prepared to face a viva voce examination based on TMA#3, during the third laboratory session.

Smart Bike Docking Station (SBDS)(Source: http://www.smartbike.com/how)


The following description is about the Smart Bike Docking Station (SBDS) and you are to analyze and design the requirements for the SBDS according to the 8051 microcontroller specifications. A typical view of the SBDS is given in Figure 1.1. The popularity of public bike sharing is easily explained as cities around the world are fighting traffic congestion, struggling to reduce pollution and working hard to extend their networks of public transportation. SBDS are especially designed for frequent use by different users and under varied conditions. The bikes are typically used between 10 to 15 times a day. With an average ride of 20 minutes, that makes over 4 hours of continuous use per day! It is clear that a public bike has different requirements than a private one. It needs to be strong and must tolerate rough handling and at the same time be easy controllable and light for the user. But most importantly it must be safe and comfortable. SBDS has been specifically designed for self-service use.
Figure 1.1: Typical view of SBDS

SBDS can be found at all central and convenient locations throughout the city. Only 3 simple steps are necessary to ensure the user care-free and individual transport: REGISTER User-code will be made available upon registration. RIDE - Type in your code at a SBDS and it will release a bike for you to ride. RETURN - When you have reached your destination, return your bike to any SBDS. The bike is automatically locked and ready for the next user! The SBDS consists of the docking modules' which lock the bicycles in place, ready for use, as well as the vertical interactive and informative column that identifies the user.

8 ECX4236 Microprocessors and Interfacing

Tutor Marked Assignment #3 2011


Design Guidelines 1. 2. 3. 4. A keypad and two seven segment displays are used in SBDS. Assume user-code is a two-digit number and ten users can be registered. User can select either RIDE mode or RETURN mode. In the RIDE mode, user needs to enter his/her user-code. When the correct usercode is detected the lock will be released and the bike released time will be recorded. 5. Assume user will be returned the bike and obey the rules. 6. In RETURN mode, user needs to place the bike into free slot and enter his/her user-code again. When the correct user-code is detected the appropriate lock will be closed and the bike return time will be recorded. Thereafter it displays the fare for the journey. 7. You can use external memory of the microcontroller to store the start and end time of a journey. 8. Fare of a journey would be calculated as one rupee per minute basis. 9. Operation of the SBDS should be simple with minimum number of keys. 10. Crystal frequency of the 8051 microcontroller is 12MHz. State all other assumptions (if any) clearly, when answering the questions. [Q1] (i) (ii) (iii) (iv) (v) Draw the external view of the system (i.e. a diagram that shows the inputs and the outputs of the system). Identify the sub units/sub modules of the system and draw the interconnected block diagram of the system using the central controller. Draw a schematic diagram of the system Draw a flowchart to represent the algorithm for RIDE, RETURN and Fare display operations of the system. Write an Assembly Language Program for the system. (Clearly show RIDE, RETURN and Fare display assembly routines withcomments)

[Q2] [Q3]

Identify the design issues and the necessary improvements of your design. Is it possible to implement your design on an ASIC (Application Specific Integrated Circuit)? Justify your answer? List the ethical issues/considerations of your design

[Q4]

9 ECX4236 Microprocessors and Interfacing

Laboratory Experiments 2011


Aim: Study the AES-51 development board and execute assembly language programs. Study the microprocessor interfacing for AES-51 development board. Study the advanced microprocessor interfacing techniques and build real time application by using 8051 microcontroller.

Objectives: Having completed the experiments you will be able to understand Familiar with the software tools for microprocessor programming. Understand about the contents of List file (*.lst) and Hex (*.hex) file. Identify the basic functions of AES-51 development board. Understanding the sensors and actuators Understanding microprocessor Interfacing techniques Hands on experience of microcontroller interfacing

Experimental Tasks: Session #1 Identify the basic functions available in the AES-51 development board. Run the self-test program and familiar with the each functions of the AES-51 development board. Familiar with the 8052 simulator Assemble the programs written in TMA#1 and observe the results by using AES-51 development board.

Session #2 Assemble and simulate the programs which you written in TMA#2 Verify ALP by using AES-51 development board with given external interfacing circuits/devices.

Session #3 Assemble and simulate the programs which you written in TMA#3 Verify ALP by using AES-51 development board with given external interfacing circuits/devices.

10 ECX4236 Microprocessors and Interfacing

You might also like