You are on page 1of 19

SULIT

UNIVERSITI MALAYSIA PERLIS


Peperiksaan Semester Kedua
Sidang Akademik 2014/2015

June2015

EET 203 -Microcontroller Systems Design


[Rekabentuk Sistem Mikropengawal]
Masa: 3jam

Please make sure that this question paper has NINETEEN (19) printed pages including
this front page before you start the examination.
[Sila pastikan kertas soalan ini mengandungi SEMBILAN BELAS (19) muka surat yang bercetak
termasuk muka hadapan sebelum anda memulakan peperiksaan ini.]

This question paper has SIX (6) questions. Answer any FIVE (5) QUESTIONS only.
Each question contributes 20 marks.
[Kertas soalan ini mengandungi ENAM (6) soalan. Jawab mana-mana UMA (5)
SOALAN sahaja. Markah bagi tiap-tiap soalan adalah 20 markah.]

SULIT

Dicetak oleh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-2-
Question 1
[Soalon I]

(a) Clearly differentiate between a microprocessor and a microcontroller in terms of


architecture, applications and instruction set.
(Bezakan denganjelas antara mikropemproses dan mikropengawal dari segi senibina, aplikasi dan
set arahan.]
(3 Marks I Markah)

(b) Develop a flowchart and then write a program to get a byte of data from PORT C.
If it is less than 100, send it to PORT B; otherwise, send it to Port D.
[Bangunkan carta alir dan kemudian tulis program untuk mendapatkan satu bait data dari PORT
C. Jika ianya adalah kurang daripada 100, hantar ke PORT B; jika tidak, hantar ke Port D.]
(5 Marks I Markah)

(c) Compare and contrast the following programs in Figure l(a), l(b), l(c) and
discuss the advantage and disadvantages of each:
[Bandingkan dan bezakan program-program dalam Rajah l(a), l(b), l(c) dan bincangkan
kelebihan dan kekurangan masing-masing:]
( 12 Marks I Markah)

void main (void)


{

TRISB =0; 1/mak.e Port B an output


PORTB = 'H';
PORTB ='E';
PORTB = 'L';
PORTB = 'L';
PORTB '0';=
}
Figure l(a)
[Rqjah l(a)]

void main (void)


{
unsigned char mydataO = "HELLO" ;
unsigned char z;
TRISB = 0; 1/mak.e Port B an output
for (z=O; z<5; z++)
=
PORTB mydata[z];
}

Figure l(b)
[Rajah l(b)]

3/-

SULIT

Dicetak o/eh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademilc, Jahatan Pendaftar.
SULIT (EET203)
-3-

void main (void)


{
rom unsigned char mydata[] = "HELLO"
//notice keyword rom
unsigned char z;
TRISB = 0; //make Port B an output
for (z=O; z<5; z++)
PORTB =mydata[z];
}

Figure l(c)
[Rajah l(c)]

SULIT

Dicetak o/eh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akmlemik. Jabatan PendLJjtar.
SULIT (EET203)
-4-
Question 2
{Soalan2]

(a) The PIC16F877A microcontroller in Figure 2 will use the LEDs and switches.
Write a complete program in to execute the following operation:
[Mikropengawal PIC16F877A dalam Rajah 2 akan menggunakan suis dan LED. Tuliskan
program lengkap untuk melaksanakan operasi berikut:]

When 'SWl' is pressed, each character of the 'HE' word will appear sequentially
and blink two (2) times by using delay 300ms.
When 'SW2' is pressed, LEDs at RC2, REO, REl and RE2 will blink three (3)
times by using delay 200ms.
When 'SW3' is pressed, LEDs (RD4, RD5, RD6 and RD7) will blink three (3)
times by using delay 150ms.
[Apabila 'SWJ' ditekan, setiap patah perkataan 'HE' akan dipaparkan berturut-turut dan akan
berkelip dua (2) kali dengan menggunakan kelewatan 300ms.
Apabila 'SW2' ditekan, LED di RC2, REO, REI dan RE2 akan berkelip tiga (3) kali dengan
menggunakan kelewatan 200ms.
Apabila 'SW3' ditekan, LED (RD4, RD5, RD6 dan RD7) akan berkelip tiga (3) kali dengan
menggunakan kelewatan 150ms.]
(14Marks I Markah)

(b) Sketch the connection of the complete circuit and answer the question 2(b) at
Appendix 1.
[lAkarkan penyambungan litar lengkap tersebut dan jawab soalan 2(b) dengan menggunakan
lAmpiran 1.]
(6 Marks I Markah)

RCl REO REl R2

RB4 RB6 RB7

Figure2
[Rajah2]

SULIT

Dicelak o/eh Unll Peperiksaan & Pengijazahan, Bahagian Pengurusan Akodemik, Jabalan Pendaftar.
SULIT (EET203)
-5-
Question 3
[Soalan3]

An early warning system consists of vibration sensor using piezo buzzer that connected to
12 VDC relay, microcontroller PIC16F877A and 2x16 characters LCD. When a quake
vibration occurs, the vibrations sensor will detect it and give signal to the microcontroller.
Therefore first line of the LCD will display "Gather!!" and blinking with delay 250 ms
and buzzer will be ON. Assume the 12 VDC relay is as switch 1 (SWI) and the buzzer
are connected to RC2.
[Sistem amaran awal terdiri daripada sensor getaran menggunakan pembaz piezo yang berhubung dengan
12 VAT geganti, mikropengawal P1C16F877A dan 2x16 karakter LCD. Apabila getaran gempa bumi
berlaku, sensor getaran akan mengesannya dan memberi isyarat kepada mikropengawal. Selaras dengan
itu, baris pertama LCD akan memaparkan "Gather!!!" dan berkelip dengan kelewatan 250 ms dan pembaz
akan BUKA. Andaikan 12 VAT geganti adalah seperti suis 1 (SW1) dan pembaz yang disambungkan
kepada RC2.]

(a) Draw a flowchart of the system.


[Lukiskan carta aliran bagi sistem tersebut.]

(8 Marks I Markah)

(b) Design a program for the operation of the system.


[Rekabentukan satu program untuk operasi sistem tersebut.]
(12 Marks I Marlcah)

SULIT

Dicetak o/eh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendajtar.
SULIT (EET203)
-6-
Question 4
[Soalan4]

(a) Mr. Ali wants to write a program to generate square wave with a period of 12 ms on
Port B.5 using 20 MHz internal clock. He is uncertain of the timer selection whether
to select Timer1 or TimerO for the program write up. Please help him to solve the
following questions:
[ Encik Ali ingin menulis program untuk menjana gelombang persegi dengan tempoh 12 ms pada pin
Port B.5 menggunakan 20 MHz jam dalaman . Beliau tidak pasti dengan pemilihan pemasa sama
ada untuk memilih Timer] atau TimerO bagi penulisan program tersebut. Sila bantu beliau untuk
menyelesaikan soalan-soalan berikut :]

(i) State two functions of timers in microcontroller systems.


[Nyatakan duafungsi pemasa dalam sistem mikropengawalan.]
(2 Marks I Markah)

(ii) For the above question, determine the initial value, N using Timed with
prescaler 1:8 and Timer() with prescaler 1:256. Please round your answer to
integer (example if the answer is 58.8d, change it to 59d).
[Bagi soalan di atas , hitung nilai pemula, N menggunakan Timerl dengan prapenskala 1:8 dan
TimerO dengan prapenskala 1:256. Sila bundarkan jawapan anda kepada integer (contohnya jika
58.8d, tukar kepada kepada 59d)]
(4 Marks I Markah)

(iii) Write a detail program using appropriate timer (Timerl or Timer()) for the
above question WITHOUT prescaler. Do use Figure 4 to start your program
write up and refer to Appendix 2 and 3. Give a reason for the Timer1 or Timer()
selection.
[Tulis satu program terperinci menggunakan pemasa sesuai (Timer] atau TimerO) TANPA
prapenskala bagi soalan di atas. Sila gunakan Rajah 4 untuk memulakan penulisan program
anda dan sila rujuk Lampiran 2 dan 3. Berikan sebab pemilihan Timer] atau TimerO.]
(10 Marks I Markah)

#include <htc.h>
_CONFIG (FOSC_HS & WDTE_OFF & PWRTE_OFF &
BOREN_OFF & LVP_OFF);
#define _XTAL_FREQ 20000000
#define LED5 RB5
void pic_init(void);
void timer_init(void);
mainO
{

Figure4
[Rajah4]

7/-

SULIT

Dicetalc o/eh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-7-
(b) PWM pulses must be generated from pin CCPl of a PIC16F877A
microcontroller. The required pulse period is 88 J.lS and the required duty cycle is
50%. Assuming that the microcontroller operates with a 20 MHz crystal and
prescale value of 16, calculate the following values to be loaded into the registers:
[Denyut PWM perlu dijana daripada pin CCPJ pada mikropengawal PIC16F877A. Tempoh nadi
yang diperlukan adalah 88 JJS dan kitar tugas yang diperlukan ialah 50 % . Dengan
mengandaikan bahawa mikropengawal beroperasi dengan kristal 20MHz dan nilai prapenskala
16, kirakan nilai berikut untuk dimuatkan ke dalam dqftar:]

(i) PR2 to be loaded into Timer2 register


[PR2 untuk dimuatkan ke dalam daftar Timer2]
(2 Marks I Markah)

(ii) (CCPRIL:CCP1CON<5:4>)
[CCPRIL:CCPJCON<5:4>]

(2 Marks I Marlcah)

SULIT

Dicetak oleh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendtif/ar.
SULIT (EET203)
-8-
Question 5
[Soalan5]

(a) Interrupts are internally or externally generated asynchronous hardware signals


that force the processor to stop its current program and carry out the function call.
Explain the difference between interrupt and polling.
[Sampukan adalah secara dalaman atau luaran hasilkan i.ryarat perkakasan tak segerak yang
memaksa pemproses untuk menghentikan program semasa dan menjalankan pangilan fungsi.
Terangkan perbezaan antara sampukan dan tinjauan.]
(4 Marks IMarkah)

(b) Evaluate the conversion time for a minimum 1.6 J.1S of AID conversion clock
(TAD) for all options of ADC bits in both the ADCONO and ADCONl registers.
Give your comments on each calculation.
[Nilaikan masa penukaran minimum untuk 1.6 JiS AID jam penukaran (TAD) untuk kesemua
pilihan bit ADC di kedua-dua daftar ADCONO dan ADCONJ. Beri ulasan anda untuk setiap
pengiraan]
(6 Marks I Markah)

(c) Figure 5 of PIC is connected to 20 MHz crystal oscillator. 64 TOSC will be used
for the conversion clock source. This program gets data (1 O-bit result) from
Channel 0 (ANO) of ADC and the digital value will be represented by LEDs
connected to PORTB (RB7 and RB6) and PORTD. When bit-9 and bit-8 of 10-bit
results are both '1', the buzzer will ON. By referring to Appendix 4 and
5, write a program so that it is right-justified.
{Rajah 5 untuk PIC dihubungkan dengan 20 Mhz pengayun kristal. 64 TOSC akan digunakan
untuk penukaran sumber jam. Program ini mendapat data (10-bit keputusan) dari Saluran 0
(ANO) ADC dan nilai digital akan diwakili oleh LED yang berhubung dengan PORTB (RB7 dan
RB6) dan PORTD. Apabila keputusan bit-9 dan bit-8 dari 10-bit adalah kedua-duanya '1',
pembaz akan BUKA. Dengan merujuk pada Lampiran 4 dan 5, tulis satu program agar ia adalah
wajar ke kanan.]

(10 Marks/ Markah)

91-

SULIT

Dicetak oleh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-9-

PIC16F877A

SV PORT

POTENTIOMETER
PORT
GND (Hieh) 1--f--1

--" BitS

Bit9

FigureS
[Rajah 5]

SULIT

Dicetak oleh Unit Peperiksaan & Pengijazahan, Sahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-10-
Question 6
[Soalan 6]

One of the most useful application is the interface of PC (Personal Computer) with
external 16x2 LCD using PIC16F877A. The interfacing takes place by using serial data
received by RS232 DB-9 PORT of the PC and displayed on 16x2 LCD using USART
(Universal Syncronous -Asyncronous receiver transmitter) of PIC16f877A
Microcontroller and MAX232 circuit. Refer Appendix 6, 7 and 8.
[Salah satu aplikasi yang paling berguna adalah antara mulw PC (Komputer Peribadi) dengan 16x2 LCD
luar menggunakan PIC16F877A . Pengantaramukaan itu berlaku dengan menggunakan data siri yang
diterima oleh RS232 DB 9 PORT PC dan dipaparkan pada LCD 16x2 menggunakan USART ( Universal
Syncronous -Asyncronous pemancar penerima) daripada PIC16F877A Mikropengawal dan litar MAX232.
Rujuklampiran 6, 7 dan B.]

(a) Sketch the complete schematic circuit diagram in Figure 6 by connecting PC


RS232, MAX232, 16x2 LCD & PIC 16F877A. Use Appendix 6 as your answer
sheet.
[IAkarkan rajah Iitar skematik yang lengkap dalam Rajah 6 dengan menyambungkan RS232 PC,
MAX232 , 16x2 LCD & PIC J6F877A . Gunakan Lompiran 6 sebagai kertas jawapan anda]
(8 Marks/ Markah)

(b) Write the initializing code for UART using C language.


[Tulis kod untuk memulakan UART dengan menggunakan bahasa C.]
(4 Marks I Markah)

char UART_Init (const long int baudrate)


{

(c) Write a suitable code program using Hi Tech C language to display the appeared
characters on the PC screen to be duplicated on the LCD using PIC16F877A, PC
RS232 serial port communication, MAX232 and DART.
[Tulis satu program kod yang sesuai menggunakan bahasa Hi Tech C untuk memaparkan aksara
muncul di skrin PC yang akan diulang pada LCD menggunakan PIC16F877A, PC RS232
komunikasi port siri, MAX232 dan UART.]
(8 Marks I Markah)

..11/

SULIT

Dlcetak oleh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-11-

Figure6
[Rajah 6]

-oooOooo-

SULIT

Dicetak o/eh Unit Peperiksaan &: Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-12-

Appendix!
[Lampiran 1]

lA~-
~
' g
~ ~

.... ~


(')

SULIT

Dicetak o/eh Unit Peperiksaan & Pengijazahan, Bahagian Penguf'U3Qn Akademik, Jabatan Pendaftar.
SULIT (EET203)
-13-
Appendix2
[Lampiran 2]

REGISTERS ASSOCIATED WITH TIMERO

vatueon: value on
Address Name Bit7 8it6 Bit5 Bit4 .BitJ 8it2 Bit1 BitO 11U other
POR,BOR Resel5
01h.101h TMRO Tlmero Module Register xxxx xxxx uuuu uuuu
0Bh,8Bh, INTCON GIE PEIE TMROIE lNJE ' -RBIE TMROIF R!'TF ReJF: 0000 ooox 0000 ooou
10Bh,18Bh I

81h,181h OPTION_REG :RBPU INTEOO.'.: TOCS TOSE PSA PS2 PS1 PSO 1111 1111 11J.1 111.1
Legend: x =unknown. u = unchanged, - = ununplemented locations read as 'o'. Shaded cells are oot used by TmerO.

OPTION_REG REGISTER
RMI-1 RJW-1 RMf1 RIW-1
I RBPU IINTEOG I TOCS TOSE PSA PS2 PSt PSO
blt7 bltO
bit7 RBPU
bit6 INTEDG
bit 5 TOCS: TMRO Clock Source Select bit
1 : Transition on TOCKI pin
=
o Internal instruction cyde clock {CLKO)
bit 4 TOSE: TMRO Source Edge Select bit
1 =Increment on high-to-low transition on TOCKI pin
o =Increment on low-to-high transition on TOCKI pin
blt3 PSA: Prescaler Assignment bit
1 :: Prescaler is assigned to the WOT
=
o Prescaler is assigned to the TimerO module
bft2.0 PS2:PSO: Prescaler Rate Select bits
Bit value TMRO Rate WDT Rate
000 1:2 1:1
COl 1:4 1; 2
010 1:8 1:4
011 1 : 16 1:8
100 1 : 32 1 : 16
l.Ol 1 : 64 1:32
llO 1 : 128 1 : 64
111 1 : 256 1 : 128

SULIT

Dicetalc oleh Unit Peperiksaan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-14-

Appendix3
[Lampiran 3]

REGISTERS ASSOCIATED WITH TIMER1 AS A TIMER/COUNTER


Value on
Value on:
AddreM Bit7 Bit6 BitS Bit3 Bit2 Bit 1 BitO all ott-
POR.BOR
Resets
08h,8Bb, INTCON GIE PEIE ll'fROIE : JNTE . . _RBIE.. -~RIIf' INTF . ROlF oooo 000x oooo ~oou
11Bh, 18Bh . . . ::..
OCh PIR1 PSPIF.f', .A9!F R(:F : ):XIF SSI?If CCP1Jf TMIU.IF TMRHF oooo oooo oooo ooo-o
8Ch PIE1 I'SPiE''' :.AI)JE: RCIE: : .:iJ<'lE -.S$PIE CCP11E :JUR2JE, TMR11E oooo 00011 oooo ooo~
OEh TMR1L Holding Regilllllr lor f19 l41atit Signficanl 8)141 of tho 16-bi TMR1 Rogist.r """"" 21XXZ uuuu ""'""
OAt TMR1H Holding Regrslerfor fte ~~ Signi!icarrtByte r* fie 16-bil TMR1 Regislltr JCtXJ< ><JDCt uu..u uuuu
101 TICON ;.,_. l ..~ T"ICKPS1 TICI<PSO T10SCEN T1SYNC TNR1CS TMRION --oo oooo --uu wuu
Lege~~d: :z: = unknow11, u ,. unchanged, - = unlrnplernenl9d. read as o. Shaded cells am not used by the T1111er I module.
Note 1: 8ilos PSPlE and PSPIF are reserved on lhe 2lj.pin devic;e~ always mwum these bits dea.

Tl<:ON: TIMER1 CONTROL REGISTER (ADDRESS 10h)


bit 7-6 Unimplemented: Read as o
bit 5-4 T1CKPS1 :T1CKPSO: Tim&r1 Input Clock Prescafe Select bits
=
11 1:8 ptescal& value
10 = 1:4 prescalevalUe
=
01 1:2 prescale \r'81ue
oo = 1:1 prescale Vlllue
bit 3 T10SCEN: Tmer 1 Osallator Enable Control brt
1 = OSCillator is enabtoo
o = Oscnlator is shut-off (the oscillator inVerter is lumed off to ellminate power drain)
bit 2 T1SYNC: Timer1 E.xtetnal Clock lnJ)U( Synchronization Control bit
When IM81CS =r
1 =Do not synchroniZe external clock input
o =SynchroniZe external dock input
When U1RICS =o:
This bit Is ignoreo.. T!mer1 uses the tntemal clock when TMR1CS =o.
bit 1 TMR1CS: Timef'l Clock Source Select bit
1:::: External clock from pin RCOlT10SOIT1CKf (on the rising edge)
o; tnternal clock (FOSC/4)
bitO TNR10N: Timer1 On bit
=
1 EnablesTtmer'l
o =Stops Timen

SULIT

Dlcetak oleh Unit Peperiksaan & PengijDZLlhan, Bahagian Pengurusan Alcademik, Jabatan Penda.ftar.
SULIT (EET203)
-15-
Append.ix4
[Lampiran 4]

ADCONO REGISTER
[DAFTAR ADCONO]

RIW-0 RIW-0 R/W-0 RIW-0 R/W-0 RJW..O U-0 RIW-0


I AOCSt ADCSO CHS2 I CHS1 I CHSO IGO/DONE I --- ADON
bit7 bitO

bit 7-0 ADCS1:ADCSO: AID conversion aoek Sefect bits (ADCONO bits In bold)
AOCON1 ADCONO Clock Conversion
<ADCS2> <ADCSt:ADCSO>
0 00 Fose/2
0 01 Fosc/8
0 10 Foscl32
(} 11 FRC (ClOCk deriVed from the internal AIDRC oscillator)
1 00 FOSCJ4
1 01 1"0Sd11:J
1 10 Fosc/64
1 11 FRC (clOck derived from 11\e internal AID RC oscillatOr)
bit 5-3 CHS2:CHSO: Analog Chamel Select bits
ooo = Channel 0 (ANO)
001 = Channel1 {AN1)
010 =Cl1annet 2 (AN2)
o11 =Channel 3 (AN3)
1oo = Channel4 {AN4}
lOl =ChannelS (AN5)
110 =ChannelS (AN6)
lll = Chamel7 {AN7)
Note: The PIC16F873A1876A deVices only implement AID channels 0 through 4; the
unimplemented setedioos are reserved. Do not select any unimplemented
channels With these devices.
bit 2 GOJDONE; AID Conversion Status bit
When ADON = 1:
1 = AID conveJ'Sion In progress (settilg thiS bit starts Ule AID conversion whidl Js automatically
Cleared by hardware When the AJO converston is complete)
o ::: AJO conversiOn not In progress
bit 1 untmptemenutd: Read as o
bJt 0 AOON: AID On bit
.1 = AID converter modt.e is powered up
o =AID converter rnod\.je is shut-a and consumes no operating current

SULIT

Dicetak oleh Unit Peperiksaon & Pengijazahan, Sahagian Pengurusan Akademik, Jabatan Pendaftar.
SULIT (EET203)
-16-
AppendixS
[Lampiran 5]

ADCONl REGISTER
[DAFTAR ADCONJ]
RJW-0 RJW-0 U-0 U-0 RIW-0 RNI-0 R/W-0
ADFM ADCS2 PCFG2 PCFG1 PCFGO
bit 7 bitO

bit 7 ADFM: AID Result Format Select bit


l =Right jUstified. Six (6) Most Significant bits of AORESH are read as 'o'.
o = leftjustifted. Six (6) Least Significant bits of ADRESL are read as 'o'.
bit 6 ADCS2: NO ConvefSion Clock Select bit {ADCON1 bitS In shaded cea and in bold)
ADCON1 A.DCONO
Clock conversion
<ADCS2> <AOCS1:ADCSO>
O, 00 f'OSCf.l
.,. . . . . ~r .. : 01 FoscJ8
. . ; 0; 10 FoSd32
. q . .. 11 FRc (dock derived from 1he internal AID RC oscillalor)
1. 00 Fosc/4
1 .... 01 Fosc/16
.1 10 Fosc/64
1 .. ll FRC (dock derlved from 1he Internal AID RC OSCillator)

bit 5-4 Unimplemented: Read as 'o'


bit 3-0 PCFG3:PCFGO: AID Port COnfiguratiOn Control bits
PCFC
<3:0> AN7 AN6 AN5 AN4 AN3 AN2 AN1 ANO VREF+ VREF CIR

0000 A A A. A A. A A A voo Vss 810


\>001 A A A A VREF+ A A A AN3 Vss 7/1
0010 0 D 0 A A A A A voo Vss 5JO
0011 0 0 0 A VREF+ A A A AN3 Vss 411
OH>O 0 0 0 0 A D A A VDD Vss 310
0101 0 0 0 0 VREF+ 0 A A AN3 Vss 2/1
Ollx 0 0 0 0 0 0 0 0 - - OJO
1000 A A A A VREF+ VREf'- A A AN3 AN2 6/2
1.001 0 D A A A A A A Voo Vss 610
101a 0 D A A VREF+ A A A AN3 Yss 511
.1011 0 0 A A \IRa:+ VREF- A A AN3 AN2 412
1100 0 D D A VREF+ VREF- A A AN3 AN2 312
1l!U 0 D D D VREF+ VREF- A A AN3 AN2 212.
1110 0 0 D 0 0 D D A Voo vss 1/U
1111 0 0 D 0 VRe+ VREF- 0 A AN3 AN2 112
A =Analog input 0 Dlgitaf 110 =
CIR =#of analog ilpUt channels/# of AID voltage references

SULIT

Dicetak o/eh Unit Peperik.saan & Pengijazahan, Bahagian Pengurusan A/cademi/c, Jabatan PendDftar. '
SULIT (EET203)
-17-
Appendix6
[Lampiran 6]

SULIT

Dicetak o/eh Unit Peperik.saan & Pengijazahan, Bahagian Pengurusan Akademik, Jabatan PendDftar.
SULIT (EET203)
-18-
Appendix7
[Lampiran 7]

REGISTER 10-1: TXSTA: TRANSMIT STATUS AND CONTROL REGISTER (ADDRESS 98h)
RJW-t) RJW-0 RIW-0 RM'-0 U-0 RNV-0 R-1 RJW-0
I CSRC TX9 TXEN SYNC .. . I BRGH TRMT TX90
bit7 bitO

bit 7 CSRC: Clock Source Select bit


Asynchronous mo<fe
Don't care.
Synchronous fJIOde;
1 =Master mode (dock generated internally from BRG)
o =Slave mode (dock from external source)
bit 6 TX9: 9-bit Transmit Enable bit
1 = Selects 9-bit transmission
=
0 Selects 8-bit transmission
bit 5 TXEN: Transmit Enable bit
=
1 Transmit enabled
o=Transmit disabled
Note: SRENICREN overrides TXEN in Sync mode.
bit 4 SYNC: USART Mode Select bit
=
1 Synchronous mode
o =Asynchronoos mode
bit 3 Unimplemented: Read as o
bit 2 BRGH: lf!Qh Baud Rate Select bit
Asvnchronous mocle:
1 = High speed
0 =Low speed
SVnchronous mode:
Unused in this mode.
bit 1 TRM'r Transmit Shift Register Status bit
I=TSRemply
o=TSRfull
bit 0 TX9D: 9th bit of Transmit Data, can be Parity bit

SULIT

DiceiQ/c oleh Unit Peperiksaan & Pengijazohan, Bahagian Pengurusan Akademik, Jabatan Pentklftar.
SULIT (EET203)
-19-
AppendixS
[l.Ampiran 8]

REGISTER 10-2: RCSTA: RECEIVE STATUS AND CONTROL REGISTER (ADDRESS 18h)
R/W-0 RJW-0 RIW-0 RIW-0 R/W-0 R-0 R-0 R-x
I SPEN RX9 SREN CREN ADDEN FERR OERR RX9D
bit7 bitO

bit 7 SPEN: Serial Port Enable bit


1 = Serial port enabled (configures RC7/RXIOT and RC61TX/CK pins as serial port pins)
=
0 Serial port disabled
bit 6 RX9: 9-bit Receive Enable bit
1 = Selects 9-bit reception
o =Selects 8-bit reception
bit 5 SREN: Single Receive Enable bit
Asynchronous mode"
Don't care.
Synchronous !I!Ode Master.
1 = Enables single receive
o = Disables single receive
This bit is cleared after reception is complete.
SVnchronous mode Slave:
Don't care.
bit 4 CREN: Continuous Receive Enable bit
Asynchronous !DOde:
1 = Enables continuous receive
o = Disables continuous receive
Synchronous mode
1 = Enables continuous receive until enable bit CREN is cleared (CREN overrides SREN)
o = Disables continuous receive
bit 3 ADDEN: Address Detect Enable bit
Asynchronous mode 9-bit CRX9 = 1)"
1 = Enables address detection, enables interrupt and load of the receive buffer when RSR<8>
is set
o = Disables address detection, all bytes are received and ninth bit can be used as parity bit
bit 2 FERR Framing Error bit
1 = Framing error (can be updated by reading RCREG register and receive next valid byte)
o = No framing error
bit 1 OERR: Overrun Error bit
1 =Overrun error (can be cleared by clearing bit CREN)
o = No overrun error
bit 0 RX9D: 9th bit of Received Data {can be parity bit but must be calwlated by user firmware)

SULIT

Dicetak oleh Unit Peperiksaan & Pengifazahan. Bahagian Pengurusan Alcademik, Jabatan Pendaftar.

You might also like