0 ratings0% found this document useful (0 votes) 57 views7 pagesExam Paper 373 - v1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
FEEB373, Semester 1, 2018/2019
QUESTION 1 [10 MARKS!
Consider the PIC18 instruction sequence in Figure 1.0 and answer the following questions:
1A
MOVLW 0x3
1B
ic
MOVLB 2
1D
1E
= ADDWF 0x30, W, BANKED
20
ADDWF 0x31, F, A
21
Figure 1.0
(a) Figure 1.0 shows few memory locations with their addresses on the left. Fill in the
machine code for the corresponding assembly instructions on the right.
[4 marks]
(b) What type of memory is represented by Figure 1.0? What technology is used for this
memory?
[2 marks]
(©) Analyze the code and state the name/address of every memory locations involved in the
execution of these instructions along with their content after the execution.
[4 marks]
Page 2 of 8FEEB373, Semester 1, 2018/2019
QUESTION 2 [20 MARKS]
(a) Figure 2.0 shows a part of a program in which a password saved in program memory is
compared byte by byte to a password entered in data memory. Study the code and then
rewrite the instructions with the required changes below:
MOVEW upper (pass)
MovWE: TBLPTRU, A
MOVLW medium (pass)
MOVWE TBLETRH, A
MovLW low (pass)
MovWE: TBLPTRL, A
LESR FSRO, 0x100
MOVLW ats
MovWE counter, A
loop TBLRD*+
MOVEF TABLAT, WREG
CPFSEQ —- POSTINC1, A
BRA wrong
DECFSZ counter, F, A
BRA loop
CALL correct_pass
BRA forever
wrong CALL wrong_pass
forever BRA forever
Pass pe "eeeb373"
Figure 2.0
(i) The password should be stored at location 0x00070 in program memory.
(ii) The entered password should be saved at location 0x80 in data memory.
(iii) The register counter should be initialized first.
(iv) Setting the table pointer has a mistake; fix it
(v) The comparison instruction has a mistake; fi
[5 marks]
Page 3 of 8FEEB373, Semester 1, 2018/2019
(b) Write a subroutine to create a time delay of SOms on @ PICI8F4550, Name the subroutine
as delayS0ms and assume the crystal frequency is 20MHz. Show all your calculations.
[5 marks]
(©) Write a program to calculate the square of FIVE (5) numbers stored in data memory at
addresses 0x100 to 0x104 and save the products starting from address 0x105 to address
Ox10E (two bytes per one product).
[10 marks]
Page 4 of 8FEEB373, Semester 1, 2018/2019
QUESTION 3 [20 MARKS]
4
Ef corcearion cosa LE
Ey Sines meee
i sess
reise, wamocves J
Ry)RapR1 | A SISaise Sin FE
voi[f [fi 3 ese poweunet: FE
2 Renee Sain Pe pt
ut Ser Rammed PR
asucrnt Do ayzt
4 says SSS Kt
Fa sonm be |
~ Siem EE
} reoarseom Fe)
oS io Pe
4 Sorecs Pa
6 Dc-MOTOR
Figure 3.0
(a) Refer to Figure 3.0, write an instruction sequence to configure input and output port
for all the devices.
[6 marks]
Page 5 of 8FEEB373, Semester 1, 2018/2019
Ut
P2
3 foscveue reamosomoa LE
mouIer Reims! EE
reves: PE
RACMNINCREE reaseuse. LS we
Ravan ireasovson FE
RADANDMRE nosso [ae ae
PAUMNREF + rose Fa
pawn Reamer |
FaannwsSvon ‘
Paeostarcu roupseocins PL
rovespicin PR
somo roapsronane Fa
Reiawnt Roupsrarcan. Pe
Repnrucantx Rowpseuecemrpta Fae D1
REGICANRK ROS/PSP5/P1B A
a Rocpspopic P22 RS
Reson sovieserio 2 —£—-_T
Reece el uw
ReveeD et
revameraurans F
Rezosc2ouanr |
Par
Figure 3.1
(b) _ Referto Figure 3.1, write a polling program to read TWO (2) switches PI and P2. When
P1=0 and P2=1, turn on D1. Otherwise, off the LED.
[7 marks]
(©) EIGTH (8) LEDs are connected to PORTH, write a rotate program to on ONE (1)
LED starting from bit 7 to bit 0. The time interval for each LED to light on be 100m
second. Assume that a subroutine name DELAY 100ms is provided in this program.
[7 marks]
Page 6 of 8FEEB373, Semester 1, 2018/2019
QUESTION 4 [20 MARKS]
(a) State what happen to program counter (PC) after RESET button is pressed.
(1 mark]
(b) — Write instructions sequence to allow a push button connected to INT1 to request
interrupt.
[5 marks]
Figure 4.0
(©) Operating principle: Refer to Figure 4.0. Upon inserting the ignition key (pushing the
switch), the system will be activated and the PICI8F458 will engage the following
operation.
The PICI8F458 will check the status of switches $1 and S2 and act according to the
following conditions:
1, If S1=0 and $2=0, then BI and L1 will be turned ON. The engine cannot be
started, E1=0.
2. If SI=1 and $2=1, then BI and LI will be turned OFF. The engine can start,
El=1.
3, If $1=1 and $2=0, then B1 is OFF and L1 goes ON. The engine can start.
4, If S1=0 and S2=1, then same action as in condition (1).
Write a program to control the hardware given in Figure 4.0 using INTO interrupt-
driven method.
Hint: Check the condition of RCO and RCI in the order as listed above.
[14 marks]
Page 7 of 8FEEB373, Semester 1, 2018/2019
QUESTION 5 [30 MARKS]
@
(b)
(©
Determine the configuration bits for the USART1 transmitter to transmit data in high
speed asynchronous mode using 8-bit data format and enable transmission.
[8 marks]
List the most commonly used A/D conversion method for 8-bit microcontrollers.
Identify and illustrate the main the block diagram of the A/D converter.
(12 marks]
Timer 1 need to be configured as a counter to count the rising edges of an unknown
signal (at the TICKI pin). The signal arrives every one second and Timer 1 should be
able to measure the frequency of the unknown signal. What are the configurations
required for Timer 1?
[10 marks]
-END OF QUESTION PAPER-
Page 8 of 8