Download Microcomputer Applications Exam for Electronic Automation & Robotics Students and more Exams Microcomputers in PDF only on Docsity! Cork Institute of Technology Bachelor of Engineering in Electronic Automation & Robotics (ACCS) - Award (EELAR_7_Y3) Summer 2008 Microcomputer Applications (Time: 2 Hours) Answer three questions. All questions carry equal marks. Mr. F. O’Reilly Dr. D. Denieffe Dr. P. O’Sullivan Q1 (a) Compare and contrast microprocessors and micro-controllers. What advantages, disadvantages does each have? [8 marks] (b) You have the following selection of micro-processors/micro-controllers available to you for a number of projects: (i) Motorola 68000 based micro- controller(MC68332), (ii) Low powered 8051 Micro-controller, (iii) Microchip PIC 16c74. (iv) AMD/Intel Pentium/Athlon Processor For each of the following application choose one and say why you think it is appropriate to that application. DVD Player Control Unit Mobile Phone Embedded Controller. Home/Office Desk Computer [16 marks] (c) The PIC 16c74 arranges its memory into two register banks. What advantages/disadvantages does this have? How do you control which register bank is addressed/selected at any time? [10 marks] [Total: 34 marks] Q2 (a) Interrupt handling is important for embedded systems. Explain what happens when an interrupt occurs in the PIC and how the interrupt should be handled. Your answer should discuss what memory addresses are used the different types of interrupts available how they can be differentiated [12 marks ] (b) Derive and explain the following formula based on the Clock Speed and Time, which can be used to calculate the pre-load values for Timer1 of the PIC Micro- controller. How can this be changed to suit Timer2? [10 marks] Pre-load Value = 10000(hex) - Time * FOSC (Using Internal Clock) Prescalar * 4 (c) Calculate the pre-load value for the 16c74 micro-controller to generate a 5.0 kHz square wave using Timer 1 or Timer2, specifying which timer it is for and showing in code how the value would be loaded in. Assume a clock of 4MHz. [12 marks] [Total: 34 marks] Q3 (a) Describe the capabilities and operation of the Analog to Digital Converter Unit of the Microchip PIC, describing the input signal levels, possible output values and the key registers used both in the configuration and operation. How does one know a conversion has 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 -> 4V 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