Source: https://mokxi.com/learn/path/registers-and-assembly
Updated: 2026-11-11

All paths

# Under the hood

Take the Arduino wrapper off: DDR, PORT and PIN, Timer 1 by hand, the vector table and interrupts, cycle-counted delays in a .S file, a bug read off a halt in the debugger, and a UART drawn by hand on a pin.

Arduino Uno R3 Free 6 lessons 5 h 4 chapters 1,990 XP Embedded engineering · Advanced +250 XP

0 of 6 done

Start the course free DDR, PORT and PIN Lesson plan for teachers

What you will build

## 2 projects, built step by step

6 lessons in 4 chapters, about 5 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### Timers by hand

Timer 1 set up register by register: a prescaler, CTC mode and OCR1A for a match every 500 ms, the compare flag polled and cleared by hand, and no millis() anywhere.
Open it in the simulator

Chapter 3 project

### Reading a halt in the debugger

Ten readings of 30 that average 4: stop the Uno on a breakpoint, watch a variable climb, step one instruction and read the carry flag in SREG, then fix the bug the halt showed you.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## Registers

Pins and a timer, written register by register.

Open 265 XP

### DDR, PORT and PIN

The three registers behind every digital pin: count in binary on three lamps with one write to PORTB, turn on a pull-up through PORTD, and read a button straight out of PIND.

0 of 6 steps

Start What is in it

Project Locked 530 XP

### Timers by hand

Timer 1 set up register by register: a prescaler, CTC mode and OCR1A for a match every 500 ms, the compare flag polled and cleared by hand, and no millis() anywhere.

0 of 6 steps

Chapter 2

## Interrupts

The vector table and handlers that run while loop() sleeps.

Locked 265 XP

### The vector table and interrupts

The 26 jumps at the start of flash, read out of the chip itself: a Timer 1 interrupt that blinks while loop() sleeps, an INT0 handler that counts presses, volatile, and reading shared data safely.

0 of 6 steps

Chapter 3

## Assembly and the debugger

Count cycles in a .S file, and read a halted board.

Locked 227 XP

### Cycle-counted delays in a .S file

Count a loop in CPU cycles from the data sheet and measure it with Timer 1, then write the delay as a function in its own assembly file and call it from C++.

0 of 5 steps

Project Locked 438 XP

### Reading a halt in the debugger

Ten readings of 30 that average 4: stop the Uno on a breakpoint, watch a variable climb, step one instruction and read the carry flag in SREG, then fix the bug the halt showed you.

0 of 6 steps

Chapter 4

## Speak a protocol

A UART frame drawn by hand on a plain pin.

Locked 265 XP

### Bit-banging a protocol

Draw UART frames by hand on a plain pin with counted delays, let the Mega's real USART receiver judge them, read them on the logic analyzer, and break the baud rate on purpose.

0 of 6 steps

Syllabus

## Every lesson in the course

All 6 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### Registers

- DDR, PORT and PIN The three registers behind every digital pin: count in binary on three lamps with one write to PORTB, turn on a pull-up through PORTD, and read a button straight out of PIND.
- Timers by hand Timer 1 set up register by register: a prescaler, CTC mode and OCR1A for a match every 500 ms, the compare flag polled and cleared by hand, and no millis() anywhere.

Chapter 2

### Interrupts

- The vector table and interrupts The 26 jumps at the start of flash, read out of the chip itself: a Timer 1 interrupt that blinks while loop() sleeps, an INT0 handler that counts presses, volatile, and reading shared data safely.

Chapter 3

### Assembly and the debugger

- Cycle-counted delays in a .S file Count a loop in CPU cycles from the data sheet and measure it with Timer 1, then write the delay as a function in its own assembly file and call it from C++.
- Reading a halt in the debugger Ten readings of 30 that average 4: stop the Uno on a breakpoint, watch a variable climb, step one instruction and read the carry flag in SREG, then fix the bug the halt showed you.

Chapter 4

### Speak a protocol

- Bit-banging a protocol Draw UART frames by hand on a plain pin with counted delays, let the Mega's real USART receiver judge them, read them on the logic analyzer, and break the baud rate on purpose.

Keep going

## The next course on your track

Under the hood is part of the embedded track, a ladder of courses from zero to expert.

Next course

### Read datasheets and schematics

The skill every hardware job asks for: schematic symbols, a first page, absolute maximum ratings, timing diagrams, register maps and pinouts, each checked on real parts. Ends with a sensor brought up from its datasheet alone.
Open the next course

Track

### Embedded track

Arduino, ESP32, Raspberry Pi Pico and STM32: pins, timing, buses, motors, WiFi, registers and debugging, every lesson checked on a simulated board.
See every course on the track

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About Under the hood

Is Under the hood free?

Yes. All 6 lessons of Under the hood are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Under the hood take?

About 5 hours: 6 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Timers by hand and Reading a halt in the debugger.

Where do I start?

With "DDR, PORT and PIN", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
