2005-12-18 11:52 PM
2005-12-14 11:17 PM
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.2005-12-15 08:27 PM
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 WoRo2005-12-16 05:00 AM
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!!!2005-12-18 01:04 AM
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.2005-12-18 08:33 PM
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. Vincent2005-12-18 09:01 PM
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.2005-12-18 10:57 PM
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, EtaPhi2005-12-18 11:52 PM
Thanks very much!