|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
double precision bit representationHi all,
I would like to know how a variable declared as double is represented with avr-libc. What is the maximum and minimum values that it can represent and with what resolution? I am performing floating point math which fails in certain occasion where i think it shouldn't. Hence my query... For an example i have a double variable called "TempDouble" which is placed at the following address in SRAM with each of the byte having the given value. How do i interpret this value in decimal? Ram Address: $0B6F $0B70 $0B71 $0B72 Value: 00 50 91 3F Thanks in Advance. -- Cheers! Kitts _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: double precision bit representationOn Thu, 7 Jul 2005 02:27:02 +0530, Kitts wrote:
> I would like to know how a variable declared as double is represented with > avr-libc. If you look at the archieves (and I think it is stated in the documentation too), you will find that double is identical to float. For more information take a look at the archieves. Volkmar _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: double precision bit representationHello,
Currently avr-gcc supports only float and not double. The byte pattern given in your query results in a float value of -1.135254 Nayani P --- Kitts <kitts@...> wrote: > Hi all, > > I would like to know how a variable declared as > double is represented with > avr-libc. What is the maximum and minimum values > that it can represent and > with what resolution? I am performing floating point > math which fails in > certain occasion where i think it shouldn't. Hence > my query... > > For an example i have a double variable called > "TempDouble" which is placed > at the following address in SRAM with each of the > byte having the given > value. How do i interpret this value in decimal? > > Ram Address: $0B6F $0B70 $0B71 $0B72 > Value: 00 50 91 3F > > Thanks in Advance. > -- > Cheers! > Kitts > > > > _______________________________________________ > AVR-GCC-list mailing list > AVR-GCC-list@... > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: double precision bit representationOn Thursday 07 Jul 2005 5:00 am IST, Parthasaradhi Nayani wrote:
Hello Nayani, When you say avr-gcc supports only float and not double do you mean that when a variable in declared as double, it is equivalent of declaring it as float? Thanks for giving me the decimal equivalent of the byte pattern. I would like to know how you do it. I tried googling around to get info but failed. May be i was not searching right! -- Cheers! Kitts PN> Hello, PN> PN> Currently avr-gcc supports only float and not double. PN> The byte pattern given in your query results in a PN> float value of -1.135254 PN> PN> Nayani P PN> PN> PN> --- Kitts <kitts@...> wrote: PN> PN> > Hi all, PN> > PN> > I would like to know how a variable declared as PN> > double is represented with PN> > avr-libc. What is the maximum and minimum values PN> > that it can represent and PN> > with what resolution? I am performing floating point PN> > math which fails in PN> > certain occasion where i think it shouldn't. Hence PN> > my query... PN> > PN> > For an example i have a double variable called PN> > "TempDouble" which is placed PN> > at the following address in SRAM with each of the PN> > byte having the given PN> > value. How do i interpret this value in decimal? PN> > PN> > Ram Address: $0B6F $0B70 $0B71 $0B72 PN> > Value: 00 50 91 3F PN> > PN> > Thanks in Advance. PN> > -- PN> > Cheers! PN> > Kitts PN> > PN> > PN> > PN> > _______________________________________________ PN> > AVR-GCC-list mailing list PN> > AVR-GCC-list@... PN> > PN> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list PN> > PN> PN> PN> __________________________________________________ PN> Do You Yahoo!? PN> Tired of spam? Yahoo! Mail has the best spam protection around PN> http://mail.yahoo.com PN> PN> PN> _______________________________________________ PN> AVR-GCC-list mailing list PN> AVR-GCC-list@... PN> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list PN> _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: double precision bit representation>Ram Address: $0B6F $0B70 $0B71 $0B72 >Value: 00 50 91 3F > > I think this page is help full: http://www.psc.edu/general/software/packages/ieee/ieee.html I get it to 1.13525390625 -Bjarne Laursen, RoseTechnology A/S _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
SBI an CBI optimizationsI am using WinAvr GCC 3.4.3 so this may have been fixed in 4.0, but I have
noticed that the compiler does not optimize the following: #define DISABLE_INTO_ISR() {GIMSK=GIMSK & ~(1<<INT0);} 176:rs485.c **** DISABLE_INTO_ISR(); 247 .LM24: 248 0086 8BB7 in r24,91-0x20 249 0088 8F7B andi r24,lo8(-65) 250 008a 8BBF out 91-0x20,r24 That is unless I am mistaken this can be done with a CBI instruction? Thanks Trampas _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: SBI an CBI optimizationsHello,
Trampas schrieb: > I am using WinAvr GCC 3.4.3 so this may have been fixed in 4.0, but I have > noticed that the compiler does not optimize the following: > > > #define DISABLE_INTO_ISR() {GIMSK=GIMSK & ~(1<<INT0);} > > 176:rs485.c **** DISABLE_INTO_ISR(); > 247 .LM24: > 248 0086 8BB7 in r24,91-0x20 > 249 0088 8F7B andi r24,lo8(-65) > 250 008a 8BBF out 91-0x20,r24 > > That is unless I am mistaken this can be done with a CBI instruction? no, when you write: GIMSK=GIMSK & ~(1<<INT0); you mean read, modify, write. you should write GIMSK &= ~(1<<INT0); then it should work. /Blueloop _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: double precision bit representationHello Kitts,
As of now there is no support for double in avr-gcc. Though I never tried to use double, I guess it will use only float. As for the byte pattern, if you have a C compiler on your system, you could write program wherein declare a pointer to unsigned char, reserve a float and make the pointer point to the float and push these values into the 4 bytes of float and then use printf with %f to print the float value. HTH. Nayani --- Kitts <kitts@...> wrote: > On Thursday 07 Jul 2005 5:00 am IST, Parthasaradhi > Nayani wrote: > Hello Nayani, > > When you say avr-gcc supports only float and not > double do you mean that > when a variable in declared as double, it is > equivalent of declaring it as > float? > > Thanks for giving me the decimal equivalent of the > byte pattern. I would > like to know how you do it. I tried googling around > to get info but failed. > May be i was not searching right! > > -- > Cheers! > Kitts > > PN> Hello, > PN> > PN> Currently avr-gcc supports only float and not > double. > PN> The byte pattern given in your query results in > a > PN> float value of -1.135254 > PN> > PN> Nayani P > PN> > PN> > PN> --- Kitts <kitts@...> wrote: > PN> > PN> > Hi all, > PN> > > PN> > I would like to know how a variable declared > as > PN> > double is represented with > PN> > avr-libc. What is the maximum and minimum > values > PN> > that it can represent and > PN> > with what resolution? I am performing floating > point > PN> > math which fails in > PN> > certain occasion where i think it shouldn't. > Hence > PN> > my query... > PN> > > PN> > For an example i have a double variable called > PN> > "TempDouble" which is placed > PN> > at the following address in SRAM with each of > the > PN> > byte having the given > PN> > value. How do i interpret this value in > decimal? > PN> > > PN> > Ram Address: $0B6F $0B70 $0B71 $0B72 > PN> > Value: 00 50 91 3F > PN> > > PN> > Thanks in Advance. > PN> > -- > PN> > Cheers! > PN> > Kitts > PN> > > PN> > > PN> > > PN> > > _______________________________________________ > PN> > AVR-GCC-list mailing list > PN> > AVR-GCC-list@... > PN> > > PN> > > PN> > > PN> > PN> > PN> > __________________________________________________ > PN> Do You Yahoo!? > PN> Tired of spam? Yahoo! Mail has the best spam > protection around > PN> http://mail.yahoo.com > PN> > PN> > PN> _______________________________________________ > PN> AVR-GCC-list mailing list > PN> AVR-GCC-list@... > PN> > > PN> > > > > _______________________________________________ > AVR-GCC-list mailing list > AVR-GCC-list@... > http://lists.nongnu.org/mailman/listinfo/avr-gcc-list > __________________________________ Yahoo! Mail Stay connected, organized, and protected. Take the tour: http://tour.mail.yahoo.com/mailtour.html _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
RE: SBI an CBI optimizationsI gave that a shot:
#define DISABLE_INTO_ISR() {GIMSK &= ~(1<<INT0);} 176:rs485.c **** DISABLE_INTO_ISR(); 247 .LM24: 248 0086 8BB7 in r24,91-0x20 249 0088 8F7B andi r24,lo8(-65) 250 008a 8BBF out 91-0x20,r24 Note that it appears to work on other registers: 95:rs485.c **** DDRD=DDRD & 0xFE; 134 .LM3: 135 000c 8898 cbi 49-0x20,0 96:rs485.c **** 97:rs485.c **** //set up PD1 (TX pin) as output 98:rs485.c **** DDRD=DDRD | 0x02; 137 .LM4: 138 000e 899A sbi 49-0x20,1 Regards, Trampas -----Original Message----- From: Alex Wenger [mailto:a.wenger@...] Sent: Thursday, July 07, 2005 11:03 AM To: Trampas Cc: avr-gcc-list@... Subject: Re: [avr-gcc-list] SBI an CBI optimizations Hello, Trampas schrieb: > I am using WinAvr GCC 3.4.3 so this may have been fixed in 4.0, but I have > noticed that the compiler does not optimize the following: > > > #define DISABLE_INTO_ISR() {GIMSK=GIMSK & ~(1<<INT0);} > > 176:rs485.c **** DISABLE_INTO_ISR(); > 247 .LM24: > 248 0086 8BB7 in r24,91-0x20 > 249 0088 8F7B andi r24,lo8(-65) > 250 008a 8BBF out 91-0x20,r24 > > That is unless I am mistaken this can be done with a CBI instruction? no, when you write: GIMSK=GIMSK & ~(1<<INT0); you mean read, modify, write. you should write GIMSK &= ~(1<<INT0); then it should work. /Blueloop _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: SBI an CBI optimizationsOn Thu, Jul 07, 2005 at 11:25:31AM -0400, Trampas wrote:
> I gave that a shot: [... with register GIMSK, it's 3 instructions] > Note that it appears to work on other registers: [... with DDRD, it's a cbi instruction] sbi/cbi only work on the first 32 I/O registers. See page 48 of the AVR Instruction Set document (the version I am reading is 0856D–AVR–08/02). Jeff _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: SBI an CBI optimizations"Trampas" <tstern@...> wrote:
>That is unless I am mistaken this can be done with a CBI instruction? I suggest you research that further. -- Later, Jeff _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
Re: SBI an CBI optimizationsTrampas schrieb:
> I gave that a shot: > > #define DISABLE_INTO_ISR() {GIMSK &= ~(1<<INT0);} > > 176:rs485.c **** DISABLE_INTO_ISR(); > 247 .LM24: > 248 0086 8BB7 in r24,91-0x20 > 249 0088 8F7B andi r24,lo8(-65) > 250 008a 8BBF out 91-0x20,r24 GIMSK is at IO-register address 59. SBI and CBI can only be used from IO-register address 0 to IO-register address 31. -- Matthias Wei?er matthias@... http://www.matwei.de _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
RE: SBI an CBI optimizationsSorry, my mistake, I did not read that it was only the first 32 IO
registers... Regards, Trampas -----Original Message----- From: avr-gcc-list-bounces+tstern=nc.rr.com@... [mailto:avr-gcc-list-bounces+tstern=nc.rr.com@...] On Behalf Of Jeff Barlow Sent: Thursday, July 07, 2005 11:49 AM To: avr-gcc-list@... Subject: Re: [avr-gcc-list] SBI an CBI optimizations "Trampas" <tstern@...> wrote: >That is unless I am mistaken this can be done with a CBI instruction? I suggest you research that further. -- Later, Jeff _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@... http://lists.nongnu.org/mailman/listinfo/avr-gcc-list |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |