cancel
Showing results for 
Search instead for 
Did you mean: 

Help Needed

adib
Associate II
Posted on December 19, 2005 at 08:52

Help Needed

8 REPLIES 8
adib
Associate II
Posted on December 15, 2005 at 08:17

Hi,

I am working with ST72F264 micro writing in asm.

I would like to know if it is possible to do a define with formula:

for exaple:

#define x #$2

relpace with:

#define x A/B

which A=#$4 and B=#$2

Thanks.

wolfgang2399
Associate II
Posted on December 16, 2005 at 05:27

Hi Gilat,

please notice: the #define statement causes the preprocessor to substitute one string by another one-by-one. Therefore you can check the result by substituting your string. Notice that x, a, y are fixed for registers and you must not redefine them.

#define s1 A/B

ld s1,A

will deliver the following string to the assembler:

ld A/B,A

As you see that will give no correct syntax.

Note: don't use comments with a #define statement because the comment is inserted as well:

#define s2 w2 ; that is a test

ld s2,A

will be substituded with

ld w2 ; that is a test,A

and causes an error.

Regards

WoRo

franco
Associate II
Posted on December 16, 2005 at 14:00

Quote:

On 16-12-2005 at 09:57, Anonymous wrote:

Hi Gilat,

Note: don't use comments with a #define statement because the comment is inserted as well:

#define s2 w2 ; that is a test

ld s2,A

will be substituded with

ld w2 ; that is a test,A

and causes an error.

Regards

WoRo

Strange!! :o I use that syntax,but it compiles very fine!!!

adib
Associate II
Posted on December 18, 2005 at 10:04

Thanks, but it didn't solve my problem.

I understand that I can't use #define, I would like to have a constant number that is calculated by formula. For example I would like an A2D threshold constant to change according to another constant. So per compilation I change the constant and all the thresholds in my software are updated in the compilation.

const = A/B

Is there a way to do that?

Thanks.

vincentchoplin9
Associate II
Posted on December 19, 2005 at 05:33

Hi,

Most assemblers allow to do this, but there is no standard for the syntax, so it depends on which assembler you are using... Which one is it?

If you get no answer here, my advice is to contact your assembler's provider directly.

Vincent

adib
Associate II
Posted on December 19, 2005 at 06:01

Hi,

I am using the assembler that comes with inDART-STX software, It is ''STMicroelectronics - Assembler - rel. 4.42''

Is there a way to do it?

Thanks.

fggnrc
Associate II
Posted on December 19, 2005 at 07:57

Gilat,

this assembler statement defines the value of ''par'' as the result of the division of A by B:

par EQU {A div B}

where A and B are known quantities.

Regards,

EtaPhi

adib
Associate II
Posted on December 19, 2005 at 08:52

Thanks very much!