Download EE3954 Microprocessors and Microcontrollers Assignment #3

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Valve RF amplifier wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Ohm's law wikipedia , lookup

Crossbar switch wikipedia , lookup

Soft error wikipedia , lookup

Power MOSFET wikipedia , lookup

Field-programmable gate array wikipedia , lookup

Flip-flop (electronics) wikipedia , lookup

TRIAC wikipedia , lookup

Operational amplifier wikipedia , lookup

Schmitt trigger wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Polythiophene wikipedia , lookup

Opto-isolator wikipedia , lookup

Charlieplexing wikipedia , lookup

Current mirror wikipedia , lookup

Rectiverter wikipedia , lookup

CMOS wikipedia , lookup

Transistor–transistor logic wikipedia , lookup

Digital electronics wikipedia , lookup

Transcript
EE3954
Microprocessors and Microcontrollers
Assignment #3 – Answer KEY
Problem 1.
1) The circuit shown at the right
shows the connections to pin RC2
of a PIC. Assume that RC2 is
configured as an input and has a
Schmitt Trigger input buffer.
5V
a) (1 pt) If operating properly
what would be the normal
(SW1 not pressed) logic state
of RC2?
RC2
R1
R2
SW1
LOGIC ‘1’
GND
b) (5 pts) What is the minimum resistance value of R1 that would prevent the PIC
from being damaged if RC2 was accidentally configured as an output and SW1
was pressed? (consider both cases: RC2 outputs a logic ‘1’ or a logic ‘0’ when
switch is closed)
Worst Case Scenario is when RC2 outputs a logic ‘1’ ( +5 Vdc) and switch is pressed.
Voltage across R1 would then be: +5 Vdc.
Maximum current allowed to be sourced by RC2 = 0.025 A
Therefore minimum value for R1 = 5 Vdc/0.025 A = 200 ohms.
1
Problem 2.
a) (4 pts) Assume that RC3 is configured as an output. Circle any of the four circuits
below that would enable the LED to be lit when RC3 = logic’1’ and not lit when
RC3 = logic’0’?
5V
5V
RC3
RC3
R1
R1
R1
R1
RC3
RC3
GND
GND
b) (4 pts) What will be the minimum value of R1 to prevent the current through the
diode from exceeding 10mA? (assume worst case for VOH, and Vdiode =1.4 V)
Worst case for VOH = 5 Vdc
Voltage across resistor = ( 5 – 1.4 )Vdc = 3.6 Vdc
Therefore minimum value for R1 would be: 3.6 Vdc / 0.010 A = 360 ohms
2
Problem 3.
The circuit shown at the right shows the connections to pin RC3 of a PIC. Assume that
RC3 is configured as an output. (assume Vdiode =1.4 V)
a) (2 pts) What will be the current
(I) into RC3, if it is a logic ‘0’?
5V
VOL can be: 0.0 to 0.6 Vdc
Imin = (5-1.4-0.6)/670 = 0.0045 A
I
Imax = (5-1.4)/670 = 0.0054 A
(Best Answer)
b) (2 pts) What will be the current
(I) into RC3, if it is a logic ‘1’?
RC3
R1 = 670 ohms
VOH can be: 4.3 to 5 Vdc
Neither will allow diode to be
Forward biased.
So I = 0 A.
Problem 4.
(3 pts) Explain in your own words the “simplified” working of a PMOS (p-type)
transistor.
The PMOS transistor acts like a switch.
If a logic ‘1’ (approx. 5Vdc) is applied to its input (gate), then the switch is open (or
‘off’).
If a logic ‘0’ (approx. 0Vdc) is applied to its input (gate), then the switch is closed (or
‘on’).
Problem 5.
3
Given the following output stage for one of the PIC Microcontroller’s port pins:
a) (1pt) Show the calculation for determining the smallest value for the resistor R
that can be used without damaging the output driver transistor. Note that you
have to account for VOL in this case.
( 5 – 1.4 – 0.6 )Vdc / 0.025 A = 120 ohm
b) (1 pt) Will the LED turn on when the output is at a logic “1” or a logic “0”?
Circle one
Logic “1”
Logic “0”
c) (1 pt) What value needs to be written to the TRISC file register bit location if we
want the corresponding PORTC pin to be an input?
Circle one:
Logic “0”
Logic “1”
d) (1 pt) Is it possible to make half of the bits of PORT B inputs and the other half
outputs at the same time. (For example bits 0,1,2,3 = inputs, bits 4,5,6,7 =
outputs)
Circle one:
YES
NO
4
Problem 6.
Given the following diagrams:
VDD
R
RC0
R
RC0
PIC16F877
PIC16F877
VSS
(a)
a)
(b)
(6 pts) Determine what logic value must be written to PORTC bit 0 to turn the LED
ON and OFF in case of setup (a) and (b), respectively. Determine also what value
must be written to TRISC bit 0 to support setup (a) and (b).
PORTC bit 0
b)
TRISC bit 0
LED ON
LED OFF
Setup (a)
1
0
0
Setup (b)
0
1
0
(2 pts) When the LED is turned ON, determine if PORTC pin 0 is sinking or
sourcing current in case of setup (a) and (b).
For Setup (a):
PORTC pin 0 is SOURCING current.
For Setup (b):
PORTC pin 0 is SINKING current.
5