#variable

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Yellow_five
Posts: 1
Joined: Sat Oct 16, 2010 1:40 pm
Location: EU

#variable

Post by Yellow_five » Sat Oct 16, 2010 9:17 pm

Hi, how can I transfer #variable from body to library.
Is that possible to change sub from lib according to #variable ?
Thanks.
Just like example:

Code: Select all

Device=18F2550
Include "expermt.bas"

#variable controler = 3
test()

#variable controler = 1
test()

#variable controler = 2
test()

#variable controler = 3
test()

End
with experimental library module "expermt.bas"

Code: Select all

module expermt

public inline sub test()
dim A,B as byte

#if controler=0 then
A=0
B=0
#endif

#if controler=1 then
A=1
B=0
#endif

#if controler=2 then
A=0
B=1
#endif

#if controler=3 then
A=1
B=1
#endif

#if controler>3 then
#warning"controler has to be in(0-3)!"
#endif

end sub
end

Post Reply