[avr-gcc-list] avr-g++ 4.3.2 and pgmspace.h

2009-03-04 Thread Kövesdi György
Hi, I tried to store some data in flash memory using pgmspace.h. It works well in C programs but I found that using C++ the things go wrong. My sample code is: $ cat x.c #include avr/io.h #include avr/pgmspace.h prog_uint8_t table[] = { 0x01, 0x02, 0x03 }; uint8_t x; void

RE: [avr-gcc-list] avr-g++ 4.3.2 and pgmspace.h

2009-03-04 Thread Weddington, Eric
-Original Message- From: avr-gcc-list-bounces+eweddington=cso.atmel@nongnu.org [mailto:avr-gcc-list-bounces+eweddington=cso.atmel@nongnu. org] On Behalf Of Kövesdi György Sent: Wednesday, March 04, 2009 2:35 AM To: avr-gcc-list@nongnu.org Subject: [avr-gcc-list]

[avr-gcc-list] Floating Point operations on tiny25

2009-03-04 Thread Rodney McCray
Does anyone have any working sample code that shows how to convert 10 bit ADC outputs into floating points using GCC. I need to work with floating points on an ATtiny25. Best Regards, Rodney ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] Floating Point operations on tiny25

2009-03-04 Thread jan
On Wed, 04 Mar 2009 18:18:22 -0800 Rodney McCray res1z...@verizon.net wrote: Does anyone have any working sample code that shows how to convert 10 bit ADC outputs into floating points using GCC. I need to work with floating points on an ATtiny25. Best Regards, Rodney

[avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread Bob Paddock
Many of the newer AVRs, Tiny88 for example, let you dynamically change the CPU clock frequency. However the AVR-LibC based delays always assume a fixed frequency based on F_CPU. I'll always know what frequency I'm at when I call a delay() function. Is there a way of doing: _delay_us( double

RE: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread Stu Bell
I'll always know what frequency I'm at when I call a delay() function. Is there a way of doing: _delay_us( double __us, uint32_t f_cpu ) and still have the compiler generate code that does not invoke floating point at run time? I could make a delay function for each clock

[avr-gcc-list] Tables

2009-03-04 Thread David VanHorn
How would I construct a lookup table of logarithms in program memory? I'll need the logarithm of N entries between 0 and 1, ex: If N = 10, then I need log(0), log(0.1), log(0.2) etc. I don't know what precision I'll need yet, but I'll need to be adjusting N, so manually creating the table with a

RE: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread Weddington, Eric
-Original Message- From: avr-gcc-list-bounces+eweddington=cso.atmel@nongnu.org [mailto:avr-gcc-list-bounces+eweddington=cso.atmel@nongnu. org] On Behalf Of Bob Paddock Sent: Wednesday, March 04, 2009 9:00 AM To: AVR-GCC Subject: [avr-gcc-list] Using delay functions

Re: [avr-gcc-list] Tables

2009-03-04 Thread Andy Warner
On Wed, Mar 4, 2009 at 12:05 PM, David VanHorn d...@mobilefusioninc.com wrote: How would I construct a lookup table of logarithms in program memory? I'll need the logarithm of N entries between 0 and 1, ex: If N = 10, then I need log(0), log(0.1), log(0.2) etc. I don't know what precision

Re: [avr-gcc-list] Tables

2009-03-04 Thread Bernard Fouché
David VanHorn wrote: How would I construct a lookup table of logarithms in program memory? I'll need the logarithm of N entries between 0 and 1, ex: If N = 10, then I need log(0), log(0.1), log(0.2) etc. I don't know what precision I'll need yet, but I'll need to be adjusting N, so manually

Re: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread David VanHorn
The delay functions require a constant so the delay can be calculated at compile time. I would think that part of the problem is that you have to introduce more code to check the value of f_cpu and to calculate the delay. This pushes the delay calculation into run-time, plus it adds more

RE: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread Weddington, Eric
-Original Message- From: avr-gcc-list-bounces+eweddington=cso.atmel@nongnu.org [mailto:avr-gcc-list-bounces+eweddington=cso.atmel@nongnu. org] On Behalf Of David VanHorn Sent: Wednesday, March 04, 2009 11:46 AM To: AVR-GCC Subject: Re: [avr-gcc-list] Using delay

[avr-gcc-list] Re: Tables

2009-03-04 Thread David Brown
David VanHorn wrote: How would I construct a lookup table of logarithms in program memory? I'll need the logarithm of N entries between 0 and 1, ex: If N = 10, then I need log(0), log(0.1), log(0.2) etc. I don't know what precision I'll need yet, but I'll need to be adjusting N, so manually

Re: [avr-gcc-list] Re: Tables

2009-03-04 Thread David VanHorn
Before you get that far, what do you want the logs for? And what base (if it matters)? And what speed and accuracy? If you need low speed and high accuracy, just use the standard C log function. If you need high speed and low accuracy and low code space, a find-first-one function will

Re: [avr-gcc-list] Floating Point operations on tiny25

2009-03-04 Thread Steven Michalske
probably something like this #define REF_VOLTAGE 2.56 float voltage = 0.0; voltage = ADC_VALUE * ( refVoltage / 2 ^ 10 ); double check that the compiler compiled the part in parentheses to a constant. As others have said, you will want to do fixed point math or other unit scaling

[avr-gcc-list] Re: AVR-GCC-list Digest, Vol 50, Issue 10

2009-03-04 Thread Nicholas Vinen
Message: 2 Date: Wed, 4 Mar 2009 13:05:39 -0500 From: David VanHorn d...@mobilefusioninc.com Subject: [avr-gcc-list] Tables To: AVR-GCC avr-gcc-list@nongnu.org Message-ID: a8ed8b370903041005q5638beb8m66021895f9a11...@mail.gmail.com Content-Type: text/plain; charset=iso-8859-1 How

[avr-gcc-list] Re: AVR-GCC-list Digest, Vol 50, Issue 10

2009-03-04 Thread David VanHorn
The C preprocessor is too basic to do this sort of thing. Functions like logarithms come from the math library the the preprocessor can't make use of libraries at compile time. This is a PERL script I use to generate sine tables to load onto a Mega48. It shouldn't be hard to adapt it to

Re: [avr-gcc-list] Re: Tables

2009-03-04 Thread Georg-Johann Lay
David VanHorn schrieb: Speed is primary, I need to get the conversion absolutely as fast as possible. Accuracy is secondary. Once I have the logs, the rest of the calculation would be fixed point. My output will be a 16 bit binary value, the sum of N log values. My question comes down to

Re: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread Joerg Wunsch
Bob Paddock graceindustr...@gmail.com wrote: Is there a way of doing: _delay_us( double __us, uint32_t f_cpu ) and still have the compiler generate code that does not invoke floating point at run time? #undef F_CPU #define F_CPU new_value _delay_us(us); F_CPU is always evaluated

Re: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread David VanHorn
F_CPU is always evaluated upon each invocation, so if you ever change it within one compilation unit, the next invocation of one of these macros will reflect this. That's compile-time, he's looking for execution-time changes in processor speed. He didn't explicitly say so, but I think he's

Re: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread Dave N6NZ
David VanHorn wrote: F_CPU is always evaluated upon each invocation, so if you ever change it within one compilation unit, the next invocation of one of these macros will reflect this. That's compile-time, he's looking for execution-time changes in processor speed. He didn't explicitly say so,

Re: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread David Kelly
On Wed, Mar 04, 2009 at 04:37:22PM -0500, David VanHorn wrote: F_CPU is always evaluated upon each invocation, so if you ever change it within one compilation unit, the next invocation of one of these macros will reflect this. That's compile-time, he's looking for execution-time changes

RE: [avr-gcc-list] Using delay functions with variable F_CPU clock?

2009-03-04 Thread Weddington, Eric
-Original Message- From: avr-gcc-list-bounces+eweddington=cso.atmel@nongnu.org [mailto:avr-gcc-list-bounces+eweddington=cso.atmel@nongnu. org] On Behalf Of David Kelly Sent: Wednesday, March 04, 2009 2:59 PM To: David VanHorn Cc: AVR-GCC Subject: Re: [avr-gcc-list]

Re: [avr-gcc-list] Re: AVR-GCC-list Digest, Vol 50, Issue 10

2009-03-04 Thread Graham Davies
David VanHorn wrote: Ok, I'll have to see what it takes to do this in windows. If this is How do I run PERL scripts in Windows, get ActivePerl from ActiveState: http://www.activestate.com/activeperl/ Graham. ___ AVR-GCC-list mailing list

Re: [avr-gcc-list] Floating Point operations on tiny25

2009-03-04 Thread Daniel O'Connor
On Thursday 05 March 2009 01:06:58 j...@lillahusetiskogen.se wrote: The big question is, why would you like to do something like that in a processor like ATtiny25? Why not 32 bit fixed point? Somewhat related.. Does anyone have or know of a compact fixed point library? (Not that I have looked

RE: [avr-gcc-list] Floating Point operations on tiny25

2009-03-04 Thread Rodney McCray
Thanks Eric, I will get back to you if I run into any trouble. Best Regards, Rodney -Original Message- From: Weddington, Eric [mailto:ewedding...@cso.atmel.com] Sent: Wednesday, March 04, 2009 7:50 AM To: Rodney McCray; AVR-GCC-list@nongnu.org Subject: RE: [avr-gcc-list] Floating Point

RE: [avr-gcc-list] Floating Point operations on tiny25

2009-03-04 Thread Weddington, Eric
-Original Message- From: avr-gcc-list-bounces+eweddington=cso.atmel@nongnu.org [mailto:avr-gcc-list-bounces+eweddington=cso.atmel@nongnu. org] On Behalf Of Daniel O'Connor Sent: Wednesday, March 04, 2009 4:36 PM To: avr-gcc-list@nongnu.org Subject: Re: [avr-gcc-list]

Re: [avr-gcc-list] Floating Point operations on tiny25

2009-03-04 Thread Daniel O'Connor
On Thursday 05 March 2009 10:11:46 Weddington, Eric wrote: Somewhat related.. Does anyone have or know of a compact fixed point library? (Not that I have looked I'll be honest) Yes. There have been posts about fixed point support in AVR GCC and avr-libc, I believe on this list and a post

Re: [avr-gcc-list] Re: sprintf

2009-03-04 Thread Joerg Wunsch
David Brown david.br...@hesbynett.no wrote: However, the compiler has a much better chance of doing bounds checking, alias checking, and other optimisations on the array expression. Why? Either the compiler knows at compile-time that foo is actually an array it has detailed information