Educated Planet
Labs

Crossover mission · Silicon Lab × Robot Lab

Robot Brain capstone: your CPU drives the car

A self-driving car’s lowest layer is a control loop: read where the lane is, steer, repeat, many times a second. Here that loop runs on the instruction set you built in Silicon Lab.

RAM address 15 holds the lane offset the camera sees 1 m ahead, from 0 to 15: 7.5 means centered, and each step is 5 cm, with higher numbers when the car is left of the lane center. OUT sets the steering from 0 to 15: 7.5 is straight, and higher numbers steer left.

The starter program copies the offset straight to the steering, so a car drifting left steers further left. Change it so the car stays in its lane for 20 s on a winding road. One of your instructions can turn any value v into 15 − v.

Simplified: a kinematic car at a steady 3 m/s, a perfect lane camera and one instruction every 10 ms.

Best after Silicon Lab Level 6, Robot Lab Level 10 (vehicles).

Instructions you will need
ADDI n
Add the operand to A.
LDA n
Load A from the RAM address.
SUBI n
Subtract the operand from A.
JMP n
Jump to a program address.
OUT
Append A to the output port.
XORI n
Bitwise XOR A with the operand.
along the road (60 m) · across ×4