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

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

RE: [avr-gcc-list] assembler expressions


From: Ben Mann
Subject: RE: [avr-gcc-list] assembler expressions
Date: Sun, 6 Mar 2005 08:24:40 +0800

Hi Jesper,

"Ah"

ok, just remove the types.

I compiled this, and got no errors:

-------------
#define F_CPU 18432000
#define F1 20000
#define F2 20001
#define LO_F ( F1 *  F_CPU / (15*16777216) ) 
#define HI_F ( F2 *  F_CPU / (15*16777216) ) 

ldi  r21,lo8(LO_F)
ldi  r22,hi8(LO_F)
ldi  r23,hi8(LO_F)
-------------

Ben Mann


-----Original Message-----
From: Jesper Hansen [mailto:address@hidden 
Sent: Saturday, 5 March 2005 10:17 PM
To: address@hidden; address@hidden
Subject: Re: [avr-gcc-list] assembler expressions



No, the c-code like stuff just results in a lot of errors like these :

file1.s:139: Error: missing ')'
file1.s:139: Error: `)' required
file1.s:139: Error: garbage at end of line
file1.s:140: Error: missing ')'
file1.s:140: Error: `)' required
file1.s:140: Error: garbage at end of line
file1.s:141: Error: missing ')'

/Jesper

----- Original Message ----- 
From: "Ben Mann" <address@hidden>
To: "'Jesper Hansen'" <address@hidden>; <address@hidden>
Sent: Saturday, March 05, 2005 2:32 PM
Subject: RE: [avr-gcc-list] assembler expressions


> Why doesn't this work?
> 
> #define F_CPU 18432000
> #define F1 20000
> #define F2 20001
> #define LO_F (unsigned long) ( (float) F1 *  F_CPU / (15*16777216) ) 
> #define HI_F (unsigned long) ( (float) F2 *  F_CPU / (15*16777216) ) 
> ...  ldi  r21,lo8(LO_F)
>  ldi  r22,hi8(LO_F)
>  ldi  r23,hi8(LO_F)
> ??
> 
> I have used code like this in the past with no problems.
> I don't know what the implications of (float) are though.
> 
> Regards
> 
> Ben Mann
> 
> -----Original Message-----
> .equ LO_F,  F1 * F_CPU/(15*16777216)
> .equ HI_F,  F2 * F_CPU/(15*16777216)
> 
> 
>







reply via email to

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