[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Best practice for external variable (newbie-ish quest
From: |
Matthew Smith |
Subject: |
Re: [avr-gcc-list] Best practice for external variable (newbie-ish question) |
Date: |
Mon, 21 Nov 2005 11:59:55 +1030 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20041206) |
Hi David
<snip />
> The only time I use "extern" is for prototyping in #include files. Even
> so, the variable has to be declared somewhere without "extern" and
> outside of a function in order to create the allocation. Make sure you
> #include the prototype file in the source file which creates the
> storage for the variable because avr-gcc will bellyache if the two do
> not match. This is one of the ways one makes the compiler double-check
> one's work.
Thanks for that; I do have everything in one file and I'm getting some
very, very odd and unpredictable actions. The system is a pump
controller that reads pressure via an ADC and uses the AVR timer to
determine a minimum run time (unless a critical pressure is reached, in
which case the timer is ignored).
I've got an LED showing me when the timer is running and another on a
solid state relay showing what the pump is supposed to be doing.
Substituting a potentiometer for the pressure transducer, I've observed
it working as planned, but sometimes the timer never expires (or won't
start) and sometimes the "virtual" pump turns on, but never off.
Having been musing about what to try to rectify this, I'll remove the
extern declarations and see if this helps.
Cheers
M
--
Matthew Smith
South Australia
http://www.kbc.net.au
- [avr-gcc-list] Best practice for external variable (newbie-ish question), Matthew Smith, 2005/11/19
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Russell Shaw, 2005/11/19
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Russell Shaw, 2005/11/19
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Joerg Wunsch, 2005/11/20
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), David Kelly, 2005/11/20
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question),
Matthew Smith <=
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), David Kelly, 2005/11/20
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Matthew Smith, 2005/11/20
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Matthew Smith, 2005/11/21
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Joerg Wunsch, 2005/11/22
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Matthew Smith, 2005/11/22
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Joerg Wunsch, 2005/11/22
- Re: [avr-gcc-list] Best practice for external variable (newbie-ish question), Russell Shaw, 2005/11/20