Download embedded systems - Microcomputer Applications - Exam 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 Bachelor of Engineering in Automation and Control - Award (EAELD_7_Y3) (ECOSY_7_Y3) (EELAR_7_Y3) Autumn 2008 Microcomputer Applications (Time: 2 Hours) Answer THREE questions. Examiners: Mr. F. O’Reilly Dr. Paula O’Sullivan Dr. David Denieffe Q1 (a) Describe two applications for a microprocessor and two applications for a micro-controller, saying why you would choose each one? [8 marks] (b) For the following are the applications of Micro-computer systems: • PlayStation Portable (PSP) handheld games console. • Central heating timeswitch with a digital timer and programmer. • Handheld Remote Control for TV/Video. For each Identify: (i) Approximate number of Input & Outputs (iii) Estimate of speed/performance required. (iv) Complexity/Range of algorithms/programmes to execute. From the following micro-controller/microprocessors, suggest suitable models and why for each of the above applications. Embedded 8051 IC, Motorola 68000 processor, Intel Pentium 3 low power family, Microchip PIC. [16 marks] (c) Why does the PIC divide its data/special function memory into 2 or 4 banks? Explain the reasons for doing this and the advantages that it brings. [10 marks] [Total: 34 marks] Q2 (a) Explain the operation and configuration of Timer 2 on the PIC micro-controller. Derive the following formula for the preload value. [10 marks] Pre-load Value = Time * FOSC (Using Internal Clock) Prescalar * 4 (b) Calculate the pre-load value for the 16c74 micro-controller to generate a 10kHz square wave using Timer2, showing in code how the value would be loaded in. Assume a clock of 4MHz. [12 marks] (c) Interrupt handling is important for embedded systems. Explain 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. [12 marks ] [Total: 34 marks] Q3 (a) You have an analog signal with a maximum frequency of 2KHz which varies in voltage from 0 -> 4V. You wish to digitise this into a numerical value at a regular sampling interval. Describe how this can be done with a Microchip PIC. Your answer should include: The manipulation of the input levels, Possible range of output values Key registers used both in the configuration and operation. How does one know one of these conversions will have completed? [14 marks] (b) Write the configuration, interrupt handling and data reading sections of a PIC assembly language program for the 16c74 micro-controller, which continually reads in an analogue voltage from 0 -> 5V on RA0 and outputs it in binary format on PORTB. [20 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)
u-0 u-0 u-0 u-0 u-0 RW-0 RW-O0 _-R/W-0
= =—7T- 7-7 = PcrG2 | PCFGt | PCFGO
bit 7 bit 0
bit7-3 _ Unimplemented: Read as '0'
bit 2-0 PCFG2:PCFG0: A/D Port Configuration Control bits
PCFG2:PCFGO| RAO | RA1 | RAZ | RAS | RAS | 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