avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] ASM in WinAVR GCC


From: E. Weddington
Subject: Re: [avr-gcc-list] ASM in WinAVR GCC
Date: Fri, 10 Jan 2003 09:44:10 -0700

On 10 Jan 2003 at 8:31, Panther Electronics wrote:

> Hi,
> 
> can this problem be solved?
> 
> #include <avr/io.h>
> #include <avr/interrupt.h>
> #include <avr/signal.h>
> 
> #define trg 0
> #define db_time 25
> unsigned char mem_db;
> unsigned char result;
> unsigned volatile char temp, wreg;
> 
> unsigned char delays(unsigned char pin, unsigned char port);
> 
> int main(void)
> {
>  for (;;)
>  {
>   temp= 0x01;
>   wreg =0x17;
>   wreg = delays(temp, wreg);
>  }
> }
> 
> unsigned char delays (unsigned char pin, unsigned char port)
> {
>  unsigned char __t;
>  asm volatile(
>  "nop" "\n\t"
>  "nop" "\n\t"
>  "mov %0, %1" "\n\t"
>  "out %2, %1" "\n\t"
>  : "=&r" (__t)
>  : "a,I" (pin), "a,I" (port)
>  );
>  return ( 0 );
> }
> 
> >make all"-------- begin --------"
> avr-gcc --version
> avr-gcc (GCC) 3.3 20021209 (experimental)
> Copyright (C) 2002 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There
> is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
> PARTICULAR PURPOSE.
> 
> "Size before:"
>    text          data     bss     dec     hex filename
>       0           122       0     122      7a Dd.hex
> avr-gcc -c -g -Os -funsigned-char -funsigned-bitfields -fpack-struct
> -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=Dd.lst
> -mmcu=at90s2313 -I. Dd.c -o Dd.o Dd.c: In function `delays': Dd.c:37:
> error: operand constraints for `asm' differ in number of alternatives
> make: *** [Dd.o] Error 1 >Exit code: 2
> 
> Thanks in advance
> 

This may be a dumb question... but, besides the nops, why do you need 
to code it in assembly?

Eric
avr-gcc-list at http://avr1.org



reply via email to

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