Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] (Newbie)1.How to write variables which are notloaded to uC but manipulated by compiler [RSS Feed]

#1 Dec. 8, 2005 21:35:28

Nigel W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] (Newbie)1.How to write variables which are notloaded to uC but manipulated by compiler


> Hi
> The background to this is:
> For making a line following robot, we need to output a PWM
> value which is done by setting TCR1A, the value(char) having
> linear relationship with speed.
> We decided to form an array(char), in which the value is
> equal to the value location.
> Now what values are put in each of the array elements we wish
> to decide by fixing a few variables which we will not require
> to change after programming.
> So, the
> Array=127-S\100*255;;Array=Array+1;Array=Array+2
> Now I do not wish to put the variable S and these
> calculations in AVR. Just the final Array can be downloaded
> in memory and it will work. How to specify such variable (as
> S) while writing declaring the variable.
> Thanks
> Sumeet


What is wrong with this way?


#include "avr/pgmspace.h"

#define S 12
#define I (127-(S*255)/100)

const char PROGMEM Array= {
I,
I+1,
I+3,
I+4,
};


Nigel Winterbottom



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] (Newbie)1.How to write variables which are notloaded to uC but manipulated by compiler [RSS Feed]

Board footer

Moderator control

Enjoy the 22nd of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support