B27POLARITY
The task
V1 and V2 put a sine wave on P0, swinging 2 volts either side of 2.5 volts.
Light the red LED on P1 while the input is above 2.5 volts,
and the green LED on P2 the rest of the time.
The board
- Sources
- V1 2 V sine at 50 Hz and V2 2.5 V
- Resistors
- R1 330 Ω and R2 330 Ω
- LEDs
- D1 red and D2 green
- Probes
- CH1, CH2, and CH3
Key idea
The middle, 2.5 volts, reads as 50 percent.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Each LED keeps its level until the next OUT on its pin, so set both on every pass.
Hint 2Show
After SUB 50, JG picks the red side. The other path lights green.
Solution
Reveal the Full SolutionThe complete program for POLARITY. 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.
Red above the middle, green below.
u1SC-2 standard
L: IN P0
SUB 50
JG UP
MOV A, 0
OUT P1
MOV A, 1
OUT P2
JMP L
UP: OUT P1
MOV A, 0
OUT P2- CYCLES
- 400
- at par
- ENERGY
- 800
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 11
- at par