You are on page 1of 3

University of Kashan Homework #4 of Microprocessor Due Date 8 !"!

#$

Faculty of Engineering

%# A simple 8-bit analog-to-digital converter device, as shown, is to be interfaced to an 8051 microcomputer. The R A!" line goes low when conversion data is available. The R A!" line should be used to interrupt the 8051 microcontroller.
A(! 6onverter 8-bit digital data Read&

:in

a# $ith the aid of a bloc% diagram show how this device can be interfaced to the 8051. b# $rite an assembl& language program which will capture '50 data samples from the A(! converter and store this data in )!ATA memor&. The program is to be interrupt driven. %& $rite an 8051 assembl& language program which will cause a timed program dela& of n seconds, where n can have a value between 1 and '55. The program design is to be based on the use of nested subroutines which will include a one milli-second delay subroutine and a one second delay subroutine. The program is to be based on software timing loops and it will not emplo& hardware timers. *how all timing calculations and assumptions. Assume that the basic instruction c&cle time for the 8051 is 1 microsecond. %" A simple burglar alarm s&stem has + ,one inputs connected to an 8051 -(. port. -f an& one of these inputs is activated a bell will sound for 5 minutes and the corresponding ,one / !, or / !*, will be activated. a# $ith the aid of a diagram describe the hardware circuit for this alarm device. b# !esign an 8051 assembl& language program to implement the re0uired functionalit& for this s&stem. %4 ight digit 1-segment displa& devices, as shown, is to be interfaced an 8051 microcomputer.
a f gg e d c b

a# $ith the aid of a simple hardware diagram, e2plain how this device can be connected to the 8051. Assume that the 1-segment displa& is a common-cathode device. *how connections to the power suppl& source and state the estimated current consumption for &our circuit. b# $rite an 8051 assembl& language subroutine which output register ban% 0 content3s to the displa&s. Assume that content of R0-R1 is 14seg code of 8 56! digits. This subroutine scans displa&s onl& one time. c# $rite an 8051 assembl& language main program to displa& 8 digits continuall&. %
$rite an 8051 assembl& language program to send a bloc% of '57 b&tes from the e2ternal memor& 8)!ATA# out through the serial port 9ART. "ou can choose to ignore the parit& bit if &ou wish. -nclude the necessar& code to configure the 9ART, baud rate timer etc.

%' a# $rite an 8051 assembl& language subroutine which will transmit an 8-bit data character via the serial port. A ninth bit is to be used as an even parit& bit. "our program must insert the correct parit& bit. b# $rite an 8051 assembl& language subroutine which will receive an 8-bit data character via the serial port. The subroutine is to be interrupt driven but it can ignore receive parit& if &ou choose. %( As part of a industrial automation s&stem two wheels are driven b& two separate motors, motor A and motor 5. The rotation sensors give a logic low level as the wheel magnet passes the sensor. ach motor can be turned on o off b& providing a logic signal as indicated in the diagram. An 8051 is to be used to control these motors where a motor can be turned on and allowed run for ; rotations and then turned off. The sensor signals will cause timer(counter interrupts.
Motor A 1= on 0 =off Motor B 1= on 0 =off

Belt drive

Belt drive

A
<agnetic Rotation *ensor A

<agnetic Rotation *ensor 5

a# $ith the aid of a bloc% diagram describe the 8051 based hardware circuit for this s&stem. b# $rite an 8051 assembl& language program which will turn on the two motors at the same time. <otor A will do '00 rotations and will then be stopped. <otor 5 will do '0,000 rotations and will then be stopped. A separate timer(counter interrupt is to be used for the control of each motor. %8 Assume that the 8051 hardware timers have a 1 microsecond clock input. a# $rite an 8051 assembl& language program which will generate a 50 =, s0uare wave at an output pin. The program is to use a 17 bit timer(counter. The timer is to be interrupt driven. b# $rite an 8051 assembl& language program which will generate a 5 >=, s0uare wave at an output pin. The program is to use an 8 bit timer(counter. The timer is to be interrupt driven. %) The figure shows a !(A 8digital to analog# converter which drives a dc motor. Assume the power stage is included in the !(A converter so that the motor can be driven directl& b& :out.
8-bit digital data in !(A 6onverter :out

!6 <otor

An 8051 microcomputer has this !(A converter connected to an -(. port. The 8051 is connected to a ?6 via the serial port. $hen a 8 bit data character is received from the ?6 it interrupts the 8051 through the 8051@s serial port interrupt and the received 8-bit data value is passed to the !(A converter so that the ?6 is effectivel& controlling the motor speed. $rite an 8051 assembl& language program to implement this s&stem. Assume a serial data baud rate of A,700 baud. *how all configuration of the 9ART etc.

%#$ An 8051 based s&stem constantl& outputs a s0uare wave at some fre0uenc& through an -(. port bit. The fre0uenc& is timed based on an 8-bit timer 8assume a 1 microsecond timer input#. The 8051 is connected to a ?6 via the serial port. $hen an 8-bit data character is received from the ?6 it interrupts the 8051 through the 8051@s serial port interrupt and the received 8-bit data value is passed to the timer so as to respecif& the fre0uenc&. Thus a ?6 programmable fre0uenc& generator is achieved. $rite an 8051 assembl& language program to implement this s&stem. Assume a serial data baud rate of 51,700 baud. *how all configuration of the 9ART, timer etc. etc. 6alculate the programmable fre0uenc& range for &our s&stem, showing all calculations. %## !esign a simple microcomputer based to& electronic organ, includes a simple %e&board consisting of 8 %e&s 8push switches# are to represent the eight %e&s for the musical scale of 6, starting at the note Middle . A simple spea%er will be connected to an output pin, through a simple amplifier circuit. .n pressing a %e& the corresponding fre0uenc& is to be sounded for 500 milliseconds

Bre0uenc& of piano 8%e& i# C 8 fre0uenc& of 8%e& i-1# # 2 ' 1(1' ' or '1(1' C 1.05A+7D0A+ which is 1.05A to D decimal places. -nteger numbers for fre0uenc& values will be sufficientl& accurate in this proEect, so round fre0uenc& to integer numbers.
1'

*o, if Middle C '7' =,. '7' =,. 6F C '7' G 1.05A C '11.+58 =,. '11 =,. ! C '11.+58 G 1.05A C 'AD.8'8 'A+ =,. -6@ 5'+ =,. The program will use two separate timer(counters. A timer(counter is to be used to generate the individual fre0uencies. A separate timer(counter is to be used to generate the 500ms duration for sounding each note. This timer(counter is also to be used in an interrupt driven mode.

You might also like