B38LATCH
The task
P0 is SET and P1 is RESET, two square waves from V1 and V2. P2 drives the LED.
SET high lights the LED and RESET high puts it out. When both are high, RESET wins.
When both are low, leave the LED as it was.
The board
- Sources
- V1 5 V square at 40 Hz and V2 5 V square at 62.5 Hz
- Resistors
- R1 330 Ω
- LEDs
- D1 red
- Probes
- CH1, CH2, and CH3
Key idea
A pin keeps its level until the next OUT, so doing nothing is how the LED remembers.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Check RESET first. Only when it is low does SET get a say.
Hint 2Show
When both read 0, jump back to the top without an OUT.
Solution
Reveal the Full SolutionThe complete program for LATCH. Open it only when you want the answer.
The reference program
The game's own solution. It passes every test and scores exactly par on every benchmark.
SET lights it, RESET puts it out, and it remembers between.
u1SC-2 standard
L: IN P1
JNZ OFF
IN P0
JZ L
OUT P2
JMP L
OFF: MOV A, 0
OUT P2- CYCLES
- 800
- at par
- ENERGY
- 1600
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 8
- at par