Syscall 2: Firmware, home

BenchChapter 9: Special nodes

B67MANCHESTER

The task

P0 reads data on CH1, one bit for every two ticks of P2, starting with the first tick.

Send each bit on P1 in Manchester code: a 1 as a tick low then a tick high, a 0 the other way.

Every bit then has an edge in its middle, so a receiver can find the clock in the data.

The board

The chip of MANCHESTERChip u1 with 3 ports: P0 digital in, reaching V1, CH1; P1 digital out, reaching R1, D1, CH2; P2 timer 20 cycles.u1CHIP SC-2P0DIGITAL INV1, CH1P1DIGITAL OUTR1, D1, CH2P2TIMER 20 CYCLES
The chip's ports, each with its kind and the parts its signal reaches. Cyan reads, lemon writes. On a narrow screen, scroll the board sideways to see all of it.
Sources
V1 2.5 V square at 41.67 Hz and V2 2.5 V square at 25 Hz
Resistors
R1 330 Ω
LEDs
D1 white
Probes
CH1 and CH2

Key idea

Read the bit on the first tick of its pair and keep it in B for the second.

Hints

Each hint goes a step further than the one before. Open them one at a time.

Hint 1Show

The first half is the opposite of the bit: a bit minus 1 is 0 for a 1 and nonzero for a 0.

Hint 2Show

IN P2, IN P0, MOV B, A, SUB 1, OUT P1, IN P2, MOV A, B, OUT P1.

Solution

Reveal the Full SolutionThe complete program for MANCHESTER. 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.

Each bit as its opposite, then itself.

u1SC-2 standard

IN P2
IN P0
MOV B, A
SUB 1
OUT P1
IN P2
MOV A, B
OUT P1
CYCLES
318
at par
ENERGY
636
at par
NODES
1
at par
INSTRUCTIONS
8
at par