Bad sign when I reply to my own posts....... :)
Looking at the library help file(s), routine in the examples, libDEMO.bas, code below....
I added the z = myconst as this is what I am trying to do. Reference an .equ in a library.
Snapshot of the mylib.lib source code below:
[code:1:e0d9345b1e]
[testconst]
testconst:
.equ myconst = 10 + 20
ldi r24,myconst
ldi r24,10 + 20
#IF vartest("myconstz>10")
#if myconstz=10
.equ klm=11
#else
.equ klm=12
#endif
#ELSE
.equ abc=13
#ENDIF
[end]
[/code:1:e0d9345b1e]
[code:1:e0d9345b1e]
'-------------------------------------------------------------------------
' LIBDEMO.BAS
' (c) 2000-2013 MCS Electronics
'In order to let this work you must put the mylib.lib file in the LIB dir
'And compile it to a LBX
'-------------------------------------------------------------------------
$regfile = "m2560def.dat" ' specify the used micro
'define the used library
$lib "mylib.lib"
'also define the used routines
$external Test
'this is needed so the parameters will be placed correct on the stack
Declare Sub Test(byval X As Byte , Y As Byte)
'reserve some space
Dim Z As Byte
'z = myconst 'doesn't work....myconst unknown, yet in report
'call our own sub routine
Call Test(1 , Z)
'z will be 2 in the used example
End[/code:1:e0d9345b1e]
Here is a snapshot of the .rpt that was outputted by the compiler....
_UARTS 4
_HWSTACKSTART 8703
_TIMEOUT 0
_PRDWORD 0
_PBIN_EXTENDED 0
_BIGSTRINGS 0
_FPROTECT 0
_HWSTACK_LOW 8671
_SWSTACK_LOW 8664
_FRAME_HIGH 8665
_XMEGA 0
MYCONST 30
CBITINFINITY 0
CMBITINFINITY 1
CBITZERO 1
MYCONST is 30. Compiler knows of it, but how to reference it?
Since I got no responses, guessing that it is not possible.
Regards,
Mark
↧