[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] (Newbie)1.How to write variables which are notloaded

From: Nigel Winterbottom
Subject: RE: [avr-gcc-list] (Newbie)1.How to write variables which are notloaded to uC but manipulated by compiler
Date: Thu, 8 Dec 2005 21:34:22 -0000

> 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[1]=127-S\100*255;;Array[2]=Array[1]+1;Array[2]=Array[1]+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[]= {

Nigel Winterbottom

reply via email to

[Prev in Thread] Current Thread [Next in Thread]