avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-chat] Need help with simple inline assembly code


From: Reza Naima
Subject: [avr-chat] Need help with simple inline assembly code
Date: Tue, 05 Jul 2005 15:54:57 -0700
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

I'm trying to generate a very fast (10mhz-ish) bit train from an avr running at ~15mhz. The only way i can think of doing it is using inline assembly. I've been trying to compile something like tihs, but I'm getting no love. Any suggestions?

thnx,
reza

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#include <avr/pgmspace.h>
#include <avr/delay.h>
#include <inttypes.h>
#include <stdio.h>


int main(void) {
       while(1) {
asm volatile("out %0, %1":: "I" (_SFR_IO_ADDR(PORTD))),"M" (254);
               asm volatile("nop"::);
asm volatile("out %0, %1":: "I" (_SFR_IO_ADDR(PORTD))),"L" (0);
               asm volatile("nop"::);
asm volatile("out %0, %1":: "I" (_SFR_IO_ADDR(PORTD))),"L" (0);
               asm volatile("nop"::);
asm volatile("out %0, %1":: "I" (_SFR_IO_ADDR(PORTD))),"M" (254);
               asm volatile("nop"::);
asm volatile("out %0, %1":: "I" (_SFR_IO_ADDR(PORTD))),"L" (0);
               asm volatile("nop"::);
       }
       return 0;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]