Transcript Today
Grading
• Lab reports: 10pts each. Demo required
• Homeworks: 3 points each (will be scaled by
difficulty)
• Ratios
–
–
–
–
–
Lab: 25%
Homework 25%
Quizzes total 25%
Final 15%
Class Participation 10%
Today
•
•
•
•
•
Grading
Homework 1 and 2 Review
Design Meeting (what’s next)
8051 I/O Ports
Materials
Homework 1 Review
• Main Issues:
–
–
–
–
–
–
–
Interrupt configuration (EA, ET0, TR0)
Time delay in doing setpoint comparison
Use of registers for static storage
Saving state in ISR
Critical Sections, do we have them?
My version
C-compiler: Semi-static local variables
• Lab Issues
– Simulation v. HW
– Incrementalism v. Big Bang
Compact ISR for PWM
CSEG
LJMP
…
ISR0:
AT
000Bh
ISR0
PUSH
PUSH
INC
MOV
ADD
MOV
POP
POP
RETI
ACC
PSW
CNT
A, CNT
A,THI
P1.1,C
PSW
ACC
()
()
(2)
(2)
(2)
(2)
()
()
(1)
Homework 2 Review
• 1ms + 1Mcycles = 1/32 + .001 sec ~ 32ms
• Let R = 10K, so C = .032/10K = 3.2uF
+
-
3.2u
RST
8051
10K
Design Meeting
•
•
•
•
Conclusions (Frequency Range, MIPS utilization)
What’s next?
Debug
User interface (text for now)
– Command mode, play mode
• Tone generation algorithms/techniques
– Single timer
• Song Parameters/Representation
A Bi-direction Port?
Write
Reg
Read
Reg
bus
Pin
What’s Inside the Buffer?
Write
Reg
Ih
This device
always “drives”
either high or
low.
Il
Will overpower
an input signal,
or get hot trying
Never High
Impedence ‘Z’
Note: this one inverts the signal, but its just an example…
I/O Ports
Dir
Ctl
Write
Reg
bus
Read
Pin
Reg
Output driver can be disconnected from the
pin so that input buffer can sense only the
input signal
This kind of bi-directional port
requires a direction control register (SFR)
for each bit of output (like StrongArm…
The 8051 (always has to be different)
Eliminate the need for configuration bits by making outputs
that can only drive strongly low (sink). There are three kinds of
pins on the 8051 (of course)
• No pull up
• Weak pull up
• Weak pull up with momentary strong pullup
To use a input pin, set output value to 1 (weak or no pullup).
External signals just have to overpower the weak pull up (low
resistance to ground).
As output, will go from 0 to 1 slowly unless you add an external
pullup
Data sheet doesn’t spec the resistance of the pull up, but it specs the
Amount of current that will result in a given voltage at the pin. For
Example, in Ports 1,2,3 Ioh = -25uA at .75Vcc.
Application: Wired NOR
8051
8051
8051
Q1) How can a processor detect a collision?
Communication bus:
Each processor tries
to send data, but
detects collision. If
collision, then stop
transmitting
Collisions are safe
because nobody
drives high. The one
who writes the zero
first gets the bus!
Summary
• Port 0:
– used as address bus for external address/data bus. Uses
active pullup in this mode. Fast
– Can use as GPIO. Must use external pullup. Pullup size
is power/speed tradeoff, up to 3.2mA
• Port 1 and 3:
– GPIO only. External pullups are optional. Power/speed
tradeoff, up to 1.6mA.
• Port 2:
– Also used for external address bus. Has active and
passive internal pullups. External pullups are optional
in GPIO mode, up to 1.6mA.
Example Problem
1) As big as possible!
Open = 0
Closed = 1
Vp
P1
R
According to Data sheet:
Processor reads a zero if Vpin < .2Vcc - .3 = 0.7V
Ilow (port 1) is .45Vp at 50uA. So what is max R?
(.45/50e-6) = 9Kohms
So the switch resistor better be smaller than 9Kohms. 4.7K is a
good choice. 2.7 is okay but higher power!
Careful w/ Coils (motors, etc)
Steady state on current: Vcc/R
Vds ~ 0 (Rds ~ 4mOhm)
But, when we try to turn off the
Mosfet quickly, what happens?
•Rds goes up quickly, but Ids drops slowly)
•If Rds becomes 1K, then Vds becomes 100V
•And instantaneous power becomes 10W
8051
Vds
Current limiter
R = 50Ohms
I =0 .1A
Coil (L)
MOSFET
Switch