AVR ASM tutorial

on way

The hack

  1. Open a new sketch in arduino IDE

  2. Upper right site i three dots

    1. left click

    2. select; New tab

    3. name it <asmcodefile>.S like myasm.S

See code examples in

Src folder list: here

TUTORIALS:

by patrick fitzgerald2

by Yeshvanth Muniraj

328P docs

Teaching - slides

Look for lectures in …

Src folder list: here

quick comments

From all incl page 624 - IMPORTANT about 1bit io ops sbi cbi

  1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses should never be written.

  2. I/O Registers within the address range 0x00 - 0x1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions.

  3. Some of the Status Flags are cleared by writing a logical one to them. Note that, unlike most other AVRs, the CBI and SBI instructions will only operate on the specified bit, and can therefore be used on registers containing such Status Flags. The CBI and SBI instructions work with registers 0x00 to 0x1F only.

  4. When using the I/O specific commands IN and OUT, the I/O addresses 0x00 - 0x3F must be used. When addressing I/O Registers as data space using LD and ST instructions, 0x20 must be added to these addresses. The ATmega48A/PA/88A/PA/168A/PA/328/P is a complex microcontroller with more peripheral units than can be supported within the 64 location reserved in Opcode for the IN and OUT instructions. For the Extended I/O space from 0x60 - 0xFF in SRAM, only the ST/STS/STD and LD/LDS/LDD instructions can be used.

  5. Only valid for ATmega88A/88PA/168A/168PA/328/328P.

  6. BODS and BODSE only available for picoPower devices ATmega48PA88PA168PA/328P

source code

Src folder list: here

hard core ?

pdf list

Jens