Using #define in a program while trying to simulate with VSM.

mortifyu

New Member
Hi there again Guru's,

I am trying to simulate with VSM, however when loading a program to a PICAXE with #define in the program, I get an error: Unknown symbol.

Clues? Help?

Regards,
Mort.
 

hippy

Technical Support
Staff member
This is unfortunately a limitation of PICAXE VSM.

For PE6 programs being compiled; they pass through a Pre-Processor then through the Compiler and it is the Pre-Processor which handles #DEFINE directives.

PICAXE VSM however can only call the Compilers so the #DEFINE is not handled by the Pre-Processor, is passed to the Compiler as is, which does not understand what that means and hence throws an error.

If you disable the Pre-Processor in PE6 ( Options -> Compiler -> Use Pre-Processor ) or use the older PE5 you will see the same behaviour as with PICAXE VSM.

So bottom line is one cannot use #DEFINE in a PICAXE VSM program.

If you need to convert a program which uses #DEFINE to one which doesn't for PICAXE VSM one option is to use PE6's Options -> Diagnostics and tick the Display Pre-Processor Output option. When a Syntax Check is done a version of the code with the #DEFINE's converted will be produced which can be copied and pasted into the program used with PICAXE VSM.
 
Top