Beruflich Dokumente
Kultur Dokumente
1-
State
True
or
False
and
why?
[5
Marks]
i-
The
Reset
input
can
be
considered
as
an
external
interrupt.
True.
Once
happened,
the
program
forced
to
go
to
the
reset
vector
at
address
0000h.
ii-
The
overall
power
consumption
depends
on
the
clock
frequency.
True.
Increasing
the
clock
frequency
increases
the
power
consumption.
iii-
Instruction
pipelining
fails
in
case
of
handling
an
interrupt
subroutine.
True.
As
the
address
of
the
next
instruction
is
changed
at
Calling
the
subroutine.
iv-
The
microcontroller
leaves
the
reset
state
once
the
power
supply
stabilized.
False.
The
microcontroller
leaves
the
reset
state
when
power
supply
is
stabilized,
oscillator
is
stabilized
and
any
demand
for
Reset
has
been
cleared.
v-
If
a
microcontroller
uses
3
Battery
cells
with
a
nominal
capacity
of
800
mAh,
running
at
15
A
consumption
leads
to
a
battery
life
of
over
6
years.
True.
Time=800*10-3/15*10-6
=
53*103
hours
=
6.08
Years
2-
Discuss
briefly
but
clearly
the
following
topics:
[10
Marks]
i-
Major
differences
between
microcontrollers
and
microprocessors.
Microprocessors
a. Main
function
is
computing
b. CPU
onto
a
single
IC
c. memory
and
input/output
interfacing
are
outside
the
microprocessor
Microcontrollers
d. Main
function
is
control
e. Micro-computer
on
a
chip
f. it
must
have
excellent
input/output
capability
ii-
Different
oscillator
circuits
supplying
the
clock
frequency
to
microcontrollers.
There
are
two
types
of
oscillator
circuit:
(1)Resistorcapacitor
(2)
Crystal
or
ceramic
(XT
crystal
HS
high
speed
LP
low
power)
iii-
Awaking
a
microcontroller
from
the
sleep
mode.
In
the
following
situations:
External
reset
through
MCLR
pin
-
WDT
wake-up
-
Occurrence
of
interrupt.
iv-
Handling
multiple
interrupts
for
a
microcontroller
having
only
one
interrupt
vector.
If
more
than
one
interrupt
is
enabled,
it
is
not
obvious
at
the
beginning
of
an
ISR
which
interrupt
has
occurred.
Therefore
we
should
identify
the
source:
at
the
beginning
of
ISR-
test
the
flags
of
all
possible
interrupts
and
determines
from
this
which
one
has
been
called.
v-
Synchronous
and
asynchronous
serial
communication.
Synchronous
Clock
must
be
transmitted
Precise
clock
not
a
fundamental
requirement
Clock
bandwidth
requirement
may
be
limiting
factor
on
data
rate
Simpler
hardware
Data
rate
defined
instantaneously
by
transmitter
No
framing
bits
overhead
Asynchronous
No
need
to
transmit
clock
Both
TX
and
RX
must
have
precise
clock
Data
bandwidth
requirement
will
be
limiting
factor
on
data
rate
More
complex
hardware
Data
rate
predetermined
3-
Using
the
following
circuit
(Fig
1)
of
the
16F84A
PORTB
(RB4-RB7)
pins,
explain
the
following:
[10
Marks]
i-
Configuring
port
pins
as
input:
WR
TRIS=1
The
data
on
the
data
bus
sets
the
TRIS
latch
(TRIS
=1)
output.
This
disables
the
buffer
between
the
data
latch
and
the
pin.
RBPU=0
The
NAND
gate
receives
two
1s
clearing
its
output
and
pulls
up
the
pin
to
be
ready
as
an
input
pin.
Configuring
port
pins
as
output:
WR
TRIS=1
The
data
on
the
data
bus
clears
the
TRIS
latch
(TRIS
=0)
output.
This
enables
the
buffer
between
the
data
latch
and
the
pin.
RBPU=1
The
NAND
gate
receives
zero
setting
its
output.
ii-
Transferring
data
to/from
the
microcontroller.
Transferring
data
to
the
microcontroller
WR
PORT=0
Starts
reception
of
data
from
the
pin
to
the
data
bus
and
disables
the
data
latch.
The
data
passes
from
the
pin
through
the
TTL
input
buffer
to
the
D
latch.
RD
Port=1
Transfers
the
data
from
the
D
latch
to
the
data
bus.
Transferring
data
from
the
microcontroller
WR
PORT=1
Enables
the
Data
latch
so
that
the
data
are
transferred
through
it
from
the
data
bus
out
to
the
pin.
RD
Port=0
NO
flow
of
data
from
the
pin
to
the
data
bus.
iii-
iv-
ADCON0
Reason
7-6
5-3
2
1
0
11
010
0
X
1
ii-
Deduce
a
formula
that
determines
the
required
ADC
resolution
(n
bits)
related
to
the
reference
voltage
of
the
converter,
the
(analog)
sensor
resolution
and
the
sensor
transfer
function.
OUT
=
(
(INP*TF)/Vref
)
*
2n
For
the
minimum
sensible
value:
the
digital
output
is
1
and
the
INP
is
the
sensor
resolution
S:
1
=
(
(S*TF)/Vref
)
*
2n
2n
=
Vref/
(S*TF)
n
=
log2
(Vref/
(S*TF))
iii-
A
temperature
sensor
having
an
output
of
40mV/oC
is
connected
to
the
ADC
input
of
the
microcontroller.
Use
the
formula
deduced
in
(ii)
to
calculate
the
ADC
resolution
for
a
sensor
resolution
of
0.1oC.
n
=
log2
(4.096
/
(0.1
*
0.04))
=
log2
(
1024
)
=
10
iv-
If
the
temperature
is
30
oC,
what
will
be
the
ADC
output
reading?
OUT
=
(
30*0.04
/
4.096
)
*
1024
=
300
1024
0
256
1
128
0
64
0
32
1
16
0
8
1
4
1
2
0
1
0
5-
[6
Marks]
i-
How
long
will
this
code
take
exactly
for
a
clock
speed
of
4Mhz?
MOVLW
=
1,
MOVWF
=
1,
2
NOP
=
2,
DECFSZ
=
1
(2),
GOTO
=
2,
RETURN
=
2
No.
of
cycles=
1+1+
99*(4)
+
2+2
+
1
=
403.
Time=
403
*
1
microS
=
403
microS
ii-
What
is
the
maximum
delay
can
you
get
from
such
subroutine?
If
this
was
nested
in
another
subroutine,
what
will
be
the
new
maximum
delay?
The
maximum
delay
is
1+1+
254*(4)
+
2+2
+
1
=
1023
microS
Nesting
=
255*
1023
=
260865
microS
iii-
Explain
if
there
is
any
restriction
about
maximizing
the
delay
time
by
nesting
the
subroutines.
This
is
restricted
by
the
limit
of
nesting
loops
determined
by
the
size
of
stack
memory
in
every
microcontroller.
7-
[12
Marks]
i-
There are many ways to answer this question. The circuit below is a possibility.
16F873A
L293D
Car battery
Power On Switch
LP2950
(12V)
Power in
Connector 1uF
tant.
100u, 10V
24k
R3
24k
uswitch 1
10k
10k
10k
(LDR2)
(LDR1)
(LDR3)
100n
1/6 'HC14 11
Motor
10
En1
In1
Out1
0V
0V
Out2
In2
VOS
VLS
In3
Out3
0V
0V
Out4
In4
En2
uswitch 2
Uswitch 3& 4
MCLR RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
RB1
Vss
RB0
Osc1 Vdd
Osc2 Vss
RC0
RC7
RC1
RC6
RC2
RC5
RC3
RC4
C4
C5
2x30p
C10
10k
R4
24k
4MHz
+5V
LEDs
C3
100n
820R
820R
820R
Motor
20k
10k
ii) Justification of main design decisions, e.g. resistor values, oscillator selection, power supply
configuration etc
ii) This will depend on design presented. In this case,
Port A bits 0,1,3: analog input
Port A bits 2,4,5: digital output
Port B bits 4-7: digital input
Port B bits 0-3: digital output
Port C all bits: digital output
Noting unused pins should be set as output.