B59HIGH SIDE
The task
Q1 is a PMOS between V1 and the lamp. It conducts while P0 is low and stops while P0 is high.
Every output starts low, so the lamp starts lit. CH1 is the drain, near 5 volts while lit.
P1 ticks every 20 cycles. Keep the lamp dark for two ticks, then lit for one, from the start.
The board
- Sources
- V1 5 V
- Resistors
- R1 1 kΩ and R2 330 Ω
- LEDs
- D1 yellow
- Transistors
- Q1, a P channel MOSFET
- Probes
- CH1
Key idea
A PMOS turns on when its gate is well below its source: a low on P0 lights the lamp.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Write 1 to P0 before the first sleep, or the lamp glows through the opening ticks.
Hint 2Show
Write 1, sleep twice, write 0, sleep once, and repeat.
Solution
Reveal the Full SolutionThe complete program for HIGH SIDE. 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.
Dark from the start, two ticks dark and one lit.
u1SC-2 standard
MOV A, 1
OUT P0
IN P1
IN P1
MOV A, 0
OUT P0
IN P1- CYCLES
- 35
- at par
- ENERGY
- 70
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 7
- at par