B03INVERTER
The task
P0 drives the base of Q1 through R1. While P0 is high, Q1 conducts and pulls CH1 to ground.
R2 pulls CH1 up to V1's 5 volts while Q1 is off.
P1 ticks every 10 cycles. Match the dips on CH1.
The board
- Sources
- V1 5 V
- Resistors
- R1 10 kΩ and R2 1 kΩ
- Transistors
- Q1, an NPN transistor
- Probes
- CH1
Key idea
Q1 inverts: a high on P0 gives a low on CH1.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
Count the ticks from one dip to the next on the scope.
Hint 2Show
Four ticks make a period: one with P0 high, three with it low.
Solution
Reveal the Full SolutionThe complete program for INVERTER. 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.
u1SC-2 standard
IN P1
MOV A, 1
OUT P0
IN P1
MOV A, 0
OUT P0
IN P1
IN P1- CYCLES
- 40
- at par
- ENERGY
- 80
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 8
- at par
Another way: Mod
A second program that also passes, by a different road, at a cost on CYCLES, ENERGY, and INSTRUCTIONS.
The tick count modulo four picks the one high tick.
u1SC-2 standard
L: IN P1
MOD 4
SUB 1
JNZ O
MOV A, 1
OUT P0
JMP L
O: MOV A, 0
OUT P0- CYCLES
- 120
- over par
- ENERGY
- 240
- over par
- NODES
- 1
- at par
- INSTRUCTIONS
- 9
- over par