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: Sat, 5 Mar 2005 21:32:19 +0800

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]