Arduino Experiment: Playing with Inline Assembler

Publié le: 14 mars 2014
sur la chaîne: Julian Ilett
25,244
465

What started with the need to embed a single assembly language instruction in an Arduino sketch, became a complete flashing LED program written in AVR assembler.

ATmega328P Pin Mapping:
http://arduino.cc/en/Hacking/PinMappi...

AVR ATmega328P Data Sheet
www.atmel.com/Images/doc8161.pdf‎

Inline Assembler Cookbook:
http://www.nongnu.org/avr-libc/user-m...

What registers are used by the C compiler?:
http://www.nongnu.org/avr-libc/user-m...

This guy did it properly:
http://ucexperiment.wordpress.com/

Arduino sketch:

void setup() {
asm("sbi 0x04, 5");
}

void loop() {
asm("start:");
asm("sbi 0x05, 5");
asm("ldi r16,40 \n\t rcall delay");
asm("cbi 0x05, 5");
asm("ldi r16,40 \n\t rcall delay");
asm("rjmp start");
asm("delay:");
asm("dec r8");
asm("brne delay");
asm("dec r9");
asm("brne delay");
asm("dec r16");
asm("brne delay");
asm("ret");
}


Sur cette page du site, vous pouvez voir la vidéo en ligne Arduino Experiment: Playing with Inline Assembler durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Julian Ilett 14 mars 2014, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 25,244 fois et il a aimé 465 téléspectateurs. Bon visionnage!