๐Ÿ‡ฎ๐Ÿ‡น IT ๐Ÿ‡ฌ๐Ÿ‡ง EN

โšก No installation ยท Just a USB cable ยท From first LED in 10 seconds

Welcome to AVR1
The AVR Assembly lab
for those starting from zero

๐Ÿ‘† Click switch 5 of drawer 5 No installation. Just one click.
๐Ÿ—„๏ธ Chip cabinet โ€” Drawers 4 and 5
4 Who commands who โ€” pin direction
76 55 32 10
0
0
0
1
0
0
0
0
5 Who goes to 5V โ€” pin voltage
76 55 32 10
0
0
0
0
0
0
0
0
๐Ÿ‘† Click the orange switch above
.org 0 rjmp init .org 0x68 init: sbi 4,5 ; drawer 4, switch 5 โ†’ output cbi 5,5 ; switch open โ†’ LED off rjmp init
โšก sbi 5,5 = "Set Bit in register"
Drawer 5 โ†’ switch 5 โ†’ closed โ†’ 5V โ†’ D13 โ†’ ๐Ÿ’ก LED on
To turn off: cbi 5,5 = "Clear Bit in register"
D13 USB ATmega328P Arduino Nano 16MHz PWR L/D13
โฌ› LED D13 โ€” off
Switch open โ†’ no voltage โ†’ LED off
๐Ÿ’ก Switch closed โ†’ 5V on D13 โ†’ LED ON!
You just wrote your first ASM instruction.
๐Ÿ—„๏ธ ATmega328P โ€” I/O REGISTERS Arduino Nano ยท UNO
0x00RES
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
0x01RES
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
0x02RES
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
0x03PINB
โ€”โ€”PINB5PINB4PINB3PINB2PINB1PINB0
0x04DDRB
โ€”โ€”DDB5DDB4DDB3DDB2DDB1DDB0
0x05PORTB
โ€”โ€”PB5PB4PB3PB2PB1PB0
0x06PINC
โ€”PINC6PINC5PINC4PINC3PINC2PINC1PINC0
0x07DDRC
โ€”DDC6DDC5DDC4DDC3DDC2DDC1DDC0
0x08PORTC
โ€”PC6PC5PC4PC3PC2PC1PC0
0x09PIND
PIND7PIND6PIND5PIND4PIND3PIND2PIND1PIND0
0x0ADDRD
DDD7DDD6DDD5DDD4DDD3DDD2DDD1DDD0
0x0BPORTD
PD7PD6PD5PD4PD3PD2PD1PD0
0x0CRES
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
0x0DRES
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
0x0ETIFR0
โ€”โ€”โ€”โ€”โ€”โ€”OCF0BTOV0
0x0FTIFR1
โ€”โ€”โ€”โ€”โ€”ICF1OCF1BTOV1
๐Ÿ—„๏ธ ARDUINO IS A CABINET WITH 256 DRAWERS. EACH DRAWER HAS 8 SWITCHES. YOU ARE THE ELECTRICIAN. EITHER YOU CONTROL THE CURRENT OR THE CURRENT CONTROLS YOU. PROGRAMMING IS THE ONLY WAY NOT TO BE PROGRAMMED.
Open the compiler and write your first line โ†’
Guided path

1. Start here
the foundations, even if you've never programmed

๐Ÿš€ Absolute first steps

Your first LED in 10 seconds

Your first experience with AVR Assembly. Two lines of code, plug in the cable, and the LED lights up. Zero knowledge required.

Start the guide to first steps with AVR Assembly โ†’
โ“ Why this

Why ATmega328?

Discover why this microcontroller is the workhorse for learning from scratch and understanding the fundamentals.

Discover why ATmega328 was chosen โ†’
๐Ÿ—บ๏ธ Visual map

Pin and Register Map

The visual reference to understand which register bit corresponds to each physical pin. Essential for beginners.

Explore the map of pins and registers โ†’
๐Ÿ“‹ Overview

What you'll learn

An overview of the path: from the first LED to timer management, through the registers.

See the complete path for learning AVR Assembly โ†’
Interactive

2. Experiment and
Test Yourself

โšก

Interactive Compiler

Write Assembly code and immediately see the generated opcodes. Includes a specific tutorial on usage, designed even for those writing their first line of code.

Open interactive compiler to write AVR Assembly in the browser โ†’
๐Ÿ’ก

Example: Light an LED in 10 seconds

The "Hello World" of electronics, explained in detail for those who have never written a line of code.

See the step-by-step example to light an LED with Assembly โ†’
โ˜ ๏ธ

ASM Crashes: Stack Disasters

Boeing 737 MAX (346 dead), Toyota, Ariane 5: PUSH/POP and CALL/RET errors that changed the world.

Explore the ethical lessons about stack errors in assembly โ†’
โ“

Register Quiz

An interactive test to check your understanding. Suitable for all levels.

Test yourself with quizzes about AVR registers โ†’
Hands-on

3. Practical Projects
Get things moving

๐Ÿฆพ G90 Servo

G90 Servo Control

Control a servo motor without using the Servo.h library, directly managing registers and timers.

๐Ÿ‡ฎ๐Ÿ‡น IT ๐Ÿ‡ฌ๐Ÿ‡ง EN
โš™๏ธ Stepper

28BYJ-48 Stepper Motor

Run a stepper motor with precise bit sequences, controlled via SBI and CBI.

Start the stepper project โ†’
Web Serial API

4. Advanced Tools
Beyond compilation

Interact directly with hardware from the browser using Web Serial. For those who want to see what really happens "under the hood".

๐Ÿ“
Read/Write Flash
๐Ÿ‘๏ธ
Read Flash
๐Ÿ”
Firmware/Reset
๐Ÿ“ก
Serial Reading
๐Ÿ”Œ
Serial Communication
โฌ†๏ธ
Nano Uploader
๐Ÿ”ฅ
Flash Tutorial
โ“
Compiler Help
Resources

Useful Resources
and External Links

๐Ÿ“„ Official ATmega328P Datasheet Microchip
๐Ÿ“ฆ avrlass library assembler in JS
๐Ÿ›œ Arduino Web Uploader dbuezas
๐Ÿ“˜ m328Pdef.inc register definitions
๐Ÿ”ง Serial Terminal
๐Ÿšœ

Welcome to CostyCNC โ€“
the primordial's refuge!

๐Ÿ’ป We don't sell dreams here. We return to the living rock of silicon. We chose ATmega328 โ€“ the limestone of electronics: cheap, simple, registers in plain sight. It's the DNA of almost all microcontrollers. If you understand this, you understand everything. And if you don't understand it, at least it's better documented than your favorite library.

๐Ÿชจ No libraries โ€“ everything written by hand in registers. In 100 years SBI will still do the same thing. Fashions pass, bits remain.
๐Ÿ”ฅ No heavy IDEs โ€“ just a text editor. The compiler is a bridge, not a prison.
๐Ÿ“ต Minimal hardware โ€“ only Arduino Nano with ATmega328. The cheapest, the simplest. No Wi-Fi, no displays, no distractions. You write the code, not the components.
๐Ÿ‘— Simple code โ€“ clear, naked, without layers. What you see is what the chip executes. No magic, no over-engineering. The registers are there, addresses in plain sight.
โ›ช Community of diggers โ€“ we share schematics, tricks and discoveries. Those who know, teach. Those who learn, dig deeper.
๐Ÿก Total self-sufficiency โ€“ no frameworks, no abstractions. You and the microcontroller. As it should be.
โณ Eternal โ€“ maker fads change, frameworks die, languages go out of style. SBI and CBI were here before you and will still be here when everything else is dust. ATmega328 is the limestone: you find it everywhere, even under the rubble of trends.
๐Ÿ“ฆ Primordial efficiency โ€“ few lines, no waste. The code you write today will work in 50 years on the same chip. Try saying that with a JavaScript framework. And if you get lost, the ATmega328 datasheet is clearer than any tutorial on the Internet.

๐ŸŒ Dig with us: costycnc.it/avr1

โ€œWe don't sell dreams here. We teach the rock. The Nano is our pickaxe. The registers are the vein. ATmega328 is the limestone on which everything rests.โ€ ๐Ÿšœ๐Ÿ’ป