This issue is resolved in build 1432 of the compiler.
The issue was the method Hugh implemented to create the second constant and he assumed that no constant would be used in the creation of subsequent constant.
When an = existed: This forced the removal of the = sign and evaluation of the constant string. There was no replace of existing constant(s). So, this created a constant with a string of FREQ-10
When an = did not exist: There was no replace of existing constant(s). So, this also created a constant with a string of FREQ-10
Build 1432
The preprocessor now properly evaluates the constant string.
* If =exist, removes the =
* If contains "+-*\/&" then replace any constants with the existing constant string then evaluate the string,
Note: The constants are handled in-sequence. The order is strict. A constant must be defined before any calculation can use it.
This now works, as so do many other mathematical structures.
#define Freq 70
#define Freq1 = FREQ - 10
or
#define Freq 70
#define Freq1 FREQ - 10
both of the above constructs generates this ASM
;wait Freq1 uSmovlw20
where wait 60 us would generate
;wait 60 uSmovlw20
Last edit: Anobium 2024-09-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Example to understand problem
From inaccurate delay error!
Instead with; #define Freq1 60
It works perfectly
Interesting. I should trap this issue, and, issue a warning.
Open up the CDF for the program.
Search for Freq1, you will find
CODE/Constant: Line 6 FREQ1 0
So, the constant is
0
.Why?
#define Freq1 Freq-10
when it should be#define Freq1 = Freq-10
but that does not work either. This needs to be resolved.Use a script as a temp fix.
Now I get this in the CDF.
How do you open CDF ?
I had searched the ASM file but couldn't find anything
Open the Preferences Application, select the Compiler Tab, select and check 'Create CDF output file', select 'OK' to save.
The CDF is not created automatically.
This issue is resolved in build 1432 of the compiler.
The issue was the method Hugh implemented to create the second constant and he assumed that no constant would be used in the creation of subsequent constant.
=
existed: This forced the removal of the=
sign and evaluation of the constant string. There was no replace of existing constant(s). So, this created a constant with a string of FREQ-10=
did not exist: There was no replace of existing constant(s). So, this also created a constant with a string of FREQ-10Build 1432
The preprocessor now properly evaluates the constant string.
* If
=
exist, removes the=
* If contains "+-*\/&" then replace any constants with the existing constant string then evaluate the string,
Note: The constants are handled in-sequence. The order is strict. A constant must be defined before any calculation can use it.
This now works, as so do many other mathematical structures.
or
both of the above constructs generates this ASM
where
wait 60 us
would generateLast edit: Anobium 2024-09-23
OK, perfect thanks for the very quick resolution.