ELEC1601 Week 9 2023
ELEC1601 Week 9 2023
(start at 14:05)
• New top
No sensor sees
obstacle –
accelerate until
speed =3
reached
No sensor sees
obstacle –
accelerate until
speed =3
reached
Once stopped.
First rotate
clockwise unless
left sensor active
or 90 degrees
Once stopped.
First rotate
clockwise unless
left sensor active
or 90 degrees
Undo rotation
Undo rotation
Undo rotation
Rotate
anticlockwise
unless right
sensor active or
90 degrees
Rotate
anticlockwise
unless right
sensor active or
Sensor active
90 degrees
– wall is on
right
The University of Sydney
Dealing with a corner
Undo rotation
Undo rotation
Reverse a bit
Reverse a bit
Compare how
long turns took -
will tell if wall is
on left or right
Wall is on right.
Rotate
anticlockwise
Wall is on right.
Rotate
anticlockwise
Wall is on right.
Rotate
anticlockwise
Done. Move
forward
No sensor sees
obstacle –
accelerate until
speed =3
reached
Slow down
Back off a bit
Return to a stop
Once stopped.
First rotate
clockwise unless
left sensor active
or 90 degrees
Undo rotation
Reverse a bit
Wall is on right.
Rotate
anticlockwise
• Examples/Addressing Modes/Subroutines
Transistors RAMs/
Gates ROMs Actuators
ALUs
Flip-Flops/ Computer Sensors
Compilers
Registers Architecture Bus
Real-world
Ones and Zeros Words Instructions Programs
interactions
LDI R21, 1
LDI R22, 2
LDI R23, 3
LDI R24, 4
JMP e3
e1: ADD R21, R22
JMP e4
e2: ADD R21, R23
JMP e1
e3: ADD R21, R24
JMP e2
e4:
– B = [1, 2, 4, 10]
–P = A
– Q = P+1
– B[0] = P+Q
– B[1] = Q-P+1
– B = [1, 2, 4, 10]
–P = A
– Q = P+1
– B[0] = P+Q
– B[1] = Q-P+1
Is there a nice way to address B[1]?
The University of Sydney Page 52
Recap Week 8
– What do you need to know?
– What are design trade-offs with computer architecture
• RISC vs CISC
– What are the standard parts of a computer architecture
• PC, Memory, Register File, ALU, Status Register, Control Circuitry
• How they relate to what you’ve learnt so far.
• How they interact.
– What are the basic AVR instructions
• How do they run on the hardware
– What does the most basic assembly program look like (in AVR)
• Data Storage
• Stack
- Examples
• Addressing Modes
• Subroutines
The University of Sydney Page 53
Addressing Mode 1: Register Direct
– Sample Instruction: (MOV)
– Where is the operand?
– Where is the address of the operand?