Download Exam: Microcomputer Applications for Electronics & Communications Students and more Exams Microcomputers in PDF only on Docsity! Cork Institute of Technology Bachelor of Engineering in Applied Electronics Design - Award Bachelor of Engineering in Communications Systems - Award (NFQ Level 7) Semester 1 06/07 Microcomputer Applications (Time: 2 Hours) Answer THREE questions. All questions carry equal marks. Data sheets attached. * Should indicate content attached to paper. Examiners: Mr. F. O’Reilly Mr. D. Denieffe Dr. R. O Dubhghaill Q1 (a) Compare and contrast microprocessors and micro-controllers. What advantages, disadvantages does each have? [8 marks] (b) You will have a selection of micro-processors/micro-controllers available to you for a number of projects. For each of the following project application identify (i) Approximate number of Input & Outputs (ii) Estimate of speed/performance required. (iii) Complexity/Range of algorithms/programmes to execute. Applications: DVD Player Remote Control Unit Handheld Music Player such as an iPod/Zen General Purpose home computer Choose one of the following processors for each application saying why you think it is appropriate to the application (i) Low Power Motorola 68000 (20MHz), (ii) Microchip PIC 16c74 (4 MHz), (iii) AMD/Intel Pentium Clone (500 MHz), (iv) Analog Devices 8051(2MHz) compatible micro-controller. [16 marks] (c) As a member of an 8-bit micro-processor design team, you are tasked to devise a scheme to vary the number of special registers from 200 (basic model) to 400(advanced model), while being restricted to using only 8 bits(max of 256) to describe which register is in use. Can you suggest a scheme to do this? Which micro-processors/micro-controller currently use such a technique? [10 marks] [Total: 34 marks] Q2 (a) Embedded/Micro-computer applications often use interrupts to signal events. Explain what an interrupt is and using the PIC as an example what happens when an interrupt occurs in the PIC and how the interrupt should be handled. Explain what memory addresses are used, the different types of interrupts available and how they can be differentiated. Give an example of two interrupts that can occur. [12 marks ] (b) Explain the operation of and configuration registers to operate Timer 2 in the PIC Micro-controllers. Name the registers used and describe the counting operation. What special features does Timer 2 have as against Timer 1? From first principles and working from the Frequency of the Oscillator (FOSC), derive the pre-load value for Timer 2 to give a 5kHz signal/pulse using FOSC of 20MHz. You are not to use the formula but explain the calculations. [14 marks] (c) Pre-load Value = 10000(hex) - Time * FOSC (Using Internal Clock) Prescalar * 4 Using the above formula calculate the pre-load value for the 16c74 micro- controller to generate a 50Hz square wave using Timer1, Showing in code how the value would be loaded in and provide, and code the control register values needed for control of the timer. Assume a clock of 4MHz. [8 marks] [Total: 34 marks] TABLE 1
1-1: BAUD RATE FORMULA
SYNC
BRGH = 0 (Low Speed) BRGH = 1 (High Speed)
0
1
(Asynchronous) Baud Rate = Fosci(64(SPBRG*1)) Baud Rate = Fosci(16(SPBRG*1))
(Synchronous) Baud Rate = Fosc/(4(SPBRG+1)) N/A
TABLE 1
1-2: REGISTERS ASSOCIATED WITH BAUD RATE GENERATOR
Address
Name
Value on: Value on
Bir? | Bité | Bid | Bird | Bind | Bit2 | Bitt | Bito POR, all other
BOR RESETS
38h
TXSTA
CSRC | 1X9 | TXEN | SYNC | — | BRGH | TRMT | TX9D | 0000 -010| 0000 -010
18h
RCSTA
SPEN | RX9 [ SREN| CREN | — | FERR | OERR | RX9D | 0000 -oox | 0000 -o0x
99h)
‘SPBRG
Baud Rate Generator register 0000 0000 | 0000 0000
Legend
REGISTE!
‘x = unknown, - = unimplemented, read as ‘0. Shaded cells are not used by the BRG.
R 12-1:
bit 7-6
bit 5-3
bit 2
bit 1
bit 0
ADCONO REGISTER (ADDRESS 1Fh)
RWw-0 Riw-o RiW-0 RIW-0 RiW-0 RW-0 U-0 AW-O
apcst | apcso | cHs2 [ cHsi [ cHso [GODONE] — ADON
bit 7 bit O
ADCS1:ADCSO: A/D Conversion Clock Select bits
00 = Fosc/2
) Fosc/s
10 = Fosc/a2
11 = FRc (clock derived from the internal A/D module RC oscillator)
CHS$2:CHSO: Analog Channel Select bits
000 = channel 0, (RAO/ANO)
901 = channel 1, (RAI
010 = channel 2, (RA2:
011 = channel 3, (RA3
100 = channel 4, (RA5/
101 = channel 5, (REO/
110 = channel 6, (REI
111 = channel 7, (RE2/AN7)(1
GO/DONE: A/D Conversion Status bit
If ADON = 1
1 = AID conversion in progress (setting this bit starts the A/D conversion)
0 = A/D conversion not in progress (this bit is automatically cleared by hardware when the A/D
conversion is complete)
Unimplemented: Read as '0'
ADON: A’D On bit
1= AID converter module is operating
0 = A/D converter module is shut-off and consumes no operating current
Note 1: A/D channels 5, 6 and 7 are implemented on the PIC16C74B only.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as 0)
-n = Value at POR 1’ = Bitis set O' = Bit is cleared x = Bitis unknown
REGISTER 12-2: ADCON1 REGISTER (ADDRESS 9Fh)
i) U-0 u-0 uo u-0 RW-0 — RMN-O —-RIW-O
= =—7T- 7-7 = PcrG2 | PCFGt | PCFGO
bit7 bito
bit7-3 Unimplemented: Read as '0'
bit2-0 PCFG2:PCFGO: A/D Port Configuration Control bits
PCFG2:PCFGO| RAO | RA1 | RAZ | RAS | RA3 | REO) |RE1")|RE2"")| Vrer
coo A A A A A A A A_| Vow
o01 A A A A_| Veer [A A A_| RAs
10 A A A A A D D D_ | Voo
ot A A A A_| Veer [ D D D_ | Ras
100 A A D D A D D D_ | voo
101 A A D D | ver] D D D | RAS
11x D D D D D D D D_ | Voo
A= Analog input = Digital I/O
Note 1: REO, RE1 and RE2 are implemented on the PIC16C74B only.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bt, read as ‘0°
-n= Value at POR ‘1 = Bitis set ‘0 = Bitis cleared x = Bit s unknown
PIC Pin-outs 40 Pin DIP Package
Pin Diagram:
PDIP, Windowed CERDIP
DR
Uo ooo
PIC16C65B
PIC16C74B
Coot
DD
oe
uo
D
6
Q
24s Ri
2a R SDA
2H=—» RO:
2H~— RO
REGISTER 7-1:
bit 1
bit o
REGISTER 8-1:
bit2
bit 1-0
TICON: TIMER1 CONTROL REGISTER (ADDRESS 10h)
U-0 U0 RWw-0 R RW-0 RW Ri RIW-0
= ol TICKPS1 | TICKPSO | TIOSCEN [TsyNc [ TMR1CS | TMR1ON
AW.
7 bit
Unimplemented: Read as
TACKPS1:T1CKPSO: Timert Input Clock Prescale Select bits
11 = 1:8 Prescale value
1.4 Prescale value
1:2 Prescale value
<1 Prescale value
TAOSCEN: Timert Oscillator Enable Control bit
1= Oscillator is enabled
Oscillator is shut-off (The oscillator inverter is turned of to eliminate power drain}
TASYNC: Timert External Clock Inout Synchro n Control bit
h 1:
nchronize external clock input
Synchronize external clock input
ITMRICS = 0
This bit is ignored. Timer’ uses the internal clock when TMR1CS = 0.
TMRICS: Timert Clock Source Select bit
1 = External clack from pin RCO/T10S0/T1CKI (on the rising edge)
© = Internal clock {Fosci4)
Timert On bit
Stops Timert
Legend:
R = Readable bit Vritable bit U = Unimplemented bit, read as ‘0°
-h = Value at POR Bit is set 0 = Bitis cleared x = Bitis unknown
T2CON: TIMER2 CONTROL REGISTER (ADDRESS 12h)
u-0 RAW-O 0 RAW W-O RAO RAND RM
[= __[routes3 [TouT#s2]| TouTPs1 | TOUTPSO [TMR2ON [T2CKPS1 | T2CKPSO
bit 7 bit
Unimplemented: Read as '0"
TOUTPS3:TOUTPSO: Timer2 Output Postscale Select bits
9900 = 1:1 Postscale
9901 = 1:2 Postscale
9910 = 1:3 Postscale
1111 = 1:16 Postscale
TMR2ON: Timer2 On bit
Timer2 is on
o= Timer2 is of
T2CKPS1:T2CKPSO: Timer2 Clock Prescale Select bits
90 = Prescaler is 1
Legend:
R = Readable bit ble bit U = Unimplemented bit, read as ‘0°
falue at POR set Q =Bitis cleared _x = Bitis unknown