B85SIGMA DELTA
The task
P0 reads a knob on CH1. P1 is a plain digital pin; R1 and C1 average it onto CH2.
On each tick of P2, add half the reading to B. At 50 or more, take 50 off and drive P1 high.
Otherwise drive P1 low. CH2 settles at the knob's level.
The board
- Sources
- V1 3.5 V, V2 2 V square at 12.5 Hz, and V3 1 V square at 6.25 Hz
- Resistors
- R1 22 kΩ
- Capacitors
- C1 1 µF
- Probes
- CH1 and CH2
Key idea
Half the reading is at most 50, so B stays under 100 and fits in a word.
Hints
Each hint goes a step further than the one before. Open them one at a time.
Hint 1Show
A reading of 30 adds 15 a tick, so P1 is high on 3 ticks out of 10.
Hint 2Show
SUB 50 and JL decide; on the low path, ADD 50 back before you store B.
Solution
Reveal the Full SolutionThe complete program for SIGMA DELTA. 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.
A first order sigma delta modulator.
u1SC-2 standard
L: IN P2
IN P0
DIV 2
ADD B
SUB 50
JL Z
MOV B, A
MOV A, 1
OUT P1
JMP L
Z: ADD 50
MOV B, A
MOV A, 0
OUT P1- CYCLES
- 791
- at par
- ENERGY
- 1582
- at par
- NODES
- 1
- at par
- INSTRUCTIONS
- 14
- at par