Escolar Documentos
Profissional Documentos
Cultura Documentos
Assignment 2
Mark Due Date : Dec 29, 2009
Hand-in your handwriting original copy. Pls use ball pen and do not Year 2009 / 2010 use pencil. Make your own photocopy before submission !
Q1. Assume that 5 binary data items are stored in RAM locations starting at 50h, as shown below. Write a program to
find the sum of all the numbers. The calculation is in 16-bit format and the result is stored in RAM locations 61h (upper 8-bit) & 60h (lower 8-bit). RAM location 50h = (71) RAM location 51h = (A1) RAM location 52h = (65) RAM location 53h = (59) RAM location 54h = (47)
Line
Label
Instruction
Comment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Q2. Write an 8051 program to generate a square wave of 25 kHz at pin P2.3 using XTAL = 12 MHz.
Label
Instruction
Comment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Q4. Write an 8051 program to display the 16 hexadecimal characters from 0 to F on a 7-segment display. Assume the 7-segment display is common anode type and is controlled by Port 1.
Line
Label
Instruction
Comment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Q5. Write a program to control an ADC0804 for data acquisition. The program monitors the ADC0804 INTR pin and brings the digital input value into register A.
Line
Label
Instruction
Comment
1 2 3 4 5 6 7 8 9 10 11 12 13
Q6. With the aid of diagram, brief describe how to use an 8051 microcontroller to regulate the temperature of a room. If the room temperature is above 25C, the 8051 will give out a signal to switch on the compressor of the airconditioner. Otherwise, the compressor is OFF. Ventilation fans are on continuously.
Line
Label
Instruction
Comment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30