Is there a directive to indicate PE simulation

cravenhaven

Senior Member
Is there a directive or 'debug' action that would only invoke code when running in the simulator.

The reason is for i/o operations that cant be simulated (can they?) I could insert code or values to simulate an input while testing the program.

eg
Actual code:
OWIN OW_Net,ownoreset,(Time1_1,Time1_2,Time2_1,Time2_2)

What I would like
OWIN OW_Net,ownoreset,(Time1_1,Time1_2,Time2_1,Time2_2)
[PE mode only] Time1_1=$xxxx:Time1_2=$xxxx .....
.
.
.


Currently I put in a line to create values but have to remember to comment it out before downloading (fraught with danger with my memory)

thanks
Allan
 

hippy

Ex-Staff (retired)
This forum seems appropriate so I'll leave it here.

There is no automatic option for determining when in simulation mode but you can use conditional compilation; add a #DEFINE SIMULATED at the top of your code and use #IFDEF SIMULATED. #IFNDEF SIMULATED, #ELSE and #ENDIF to conditionally compile code for a real chip or simulation. The "SIMULATED" can be any name you want to choose.

Code:
#Define SIMULATED
Do
  #IfDef SIMULATED
    SerTxd( "Simulated", CR, LF )
  #Else
    SerTxd( "Real PICAXE chip", CR, LF )
  #EndIf
Loop
 

cravenhaven

Senior Member
I thought it might be the case.
Maybe it could be considered because there are a few instances I've come across where the simulator is different from the real thing.

Thanks very much for the reply
 
Top