מערכות משובצות מחשב
✦ בנוי על ידי פהד גאנם ✦
العربية
☀ מצב בהיר
2
▾
✕
DDRD · PORTD · PIND | pinMode(pin, OUTPUT) ⟹ DDRD |= (1<<pin) | digitalWrite(pin, HIGH) ⟹ PORTD |= (1<<pin) | digitalRead(pin) ⟹ (PIND >> pin) & 1 | R =
V
cc
− V
f
I
500 ms
DDRD
—
PORTD
—
PIND
—
V
R
= 5 − 2 = 3 V
R =
3
0.020
= 150 Ω
20 mA = I
rec
< 40 mA = I
abs max
n =
200
20
= 10
I =
3
220
= 13.6 mA → n =
200
13.6
= 14
3
▾
✕
n =
V
in
· 1024
V
ref
| V
in
=
n · V
ref
1024
| Δ =
V
ref
1024
| D =
value
255
| V
avg
= V
cc
· D | t
on
= D · T
50 %
128
—
—
—
—
Δ =
5
1024
= 4.88 mV
Δt =
4.88
10
= 0.49 °C
V
in
= 25 · 10 = 250 mV → n =
0.250 · 1024
5
= 51.2 → 51
Δ =
1.1
1024
= 1.07 mV | Δt = 0.11 °C | n =
0.250 · 1024
1.1
= 232
t
max
=
1.1
0.010
= 110 °C
5
▾
✕
attachInterrupt( digitalPinToInterrupt(2), isr, RISING ) | volatile | if( millis() − t
0
>= interval ) | f
poll
=
1
t
loop
| p
hit
=
t
w
T
pulse
| t
digit
=
T
N
5.0 Hz
30 ms
100 ms
400 ms
3.0 s
100 Hz
—
—
—
—
T =
1
30
= 33.3 ms
f
poll
=
1
0.100
= 10 /s
p =
5
33.3
= 0.15
10 · 0.15 = 1.5 ( 30 )
30 / 30 | t
resp
≤ t
loop
vs t
resp
≈ t
isr entry
6
▾
✕
t
bit
=
1
baud
| N
bits
= 1 + 8 + p + 1 | t
frame
= N
bits
· t
bit
| chars/s =
baud
N
bits
| t
msg
= L · t
frame
9600 baud
A · 65
—
—
—
—
t
bit
=
1
9600
= 104.17 µs
N = 1 + 8 + 1 = 10 → t
frame
= 10 · 104.17 = 1.0417 ms
chars/s =
9600
10
= 960
L = 7 + 2 = 9 → t = 9 · 1.0417 = 9.375 ms
115200
9600
= 12 → t =
9.375
12
= 0.781 ms
→
🏠
♿