Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: variable/constant input from a PC ?

2004-07-14 by James Wagner

Dave -

In programming, especially embedded processors (like AVR),
the term "constant" has a specific meaning. Almost always,
it is a quantity that is defined at the time the program is
written and does not change again. For example, If you
count seconds with a timer and want to determine minutes,
you would divide seconds by 60 and that "60" you specify in
code is a constant.

"Variable" encompases virtually all other data (with a few
somewhat esoteric exceptions). It could be something that
changes on every pass through the "main" loop; it could be
a return address that is pushed onto the stack to service
an interrupt. It could be something that changes once in a
while. It just is not "fixed" at the time the program is
compiled.

For something of the sort you are discussing, saving in
EEProm would be just fine. And, it makes a lot of sense. 

Now, there is, admittedly, a "grey area". If you have a
table of values in program memory and select ONE depending
on some condition, then those are constants as far as
coding is concerned. But, as soon as loaded into a register
or SRAM to use, they are, for all practical purposes,
variables. 

My point is not to criticise you! Far from it. It is simply
to point out that the term "constant" has a rather well
defined meaning in the context of programming.

Sounds like an interesting project...

Jim
 
---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.