Simulator issues - technical, is this my doing or the software?

Coyoteboy

Senior Member
Hi, I've been having a few problems with the simulator in 5.2.6 - some variables are not updated in the sim, I have a variable at b28 that never seems to change, yet a dependant variable (updated with symbolic versions of b36=b28) changes as if the original variable was functioning normally.

Also, when re-starting the simulator, the ADC values show up as zero but "remember" their last used position, meaning debugging is getting to be a pain as I have to check each ADC value every restart. If you click < next to the ADC value it jumps to 5 less than the original value. Doesnt matter if I close the sim by hitting the x in the variables box or by pressing "stop", I have to manually restart the whole programming environment to reset to zero.

Anyone else get this, or is it just me?
 

hippy

Technical Support
Staff member
As only the PICAXE X2's have b28 I assume you are using an X2. It works for me with -

#Picaxe 28x2
Do
b28 = b28 + 1
Loop

Not sure what you mean by "a dependant variable (updated with symbolic versions of b36=b28)". It may be best to post your code.

The READADC issue seems to be a simulator bug which we will investigate, the internal copy of ADC levels which are used while executing don't seem to be resetto zero.
 

Coyoteboy

Senior Member
Hi Hippy,

Yup, its a 40X2, The code in question is strung out over a sequence of subroutines, all of which work fine but the sim doesnt seem to follow suit:


Code:
if state<>0 then known				
	if sense < 128 then close	
state=3
The above code resides in a gosub function and works fine, when state is 0 it checks for 128+ on the sense var, when it doesnt find it it sets state (b28) to 3 (although the sim software doesnt show this at all). After returning out of this subroutine theres a simple function that copies the contents of "state" into another var (oldsense) and then another conditional that acts on the current version of state. The oldsense var reflects the "state" value that should have been present but never displayed, and the conditional executes correctly, but at no time does b28 in the sim vary from 0. I can't really post my code as it will be used later by other groups who may well copy it from here, which would defeat the purpose of their work, and it's also about 12K long in text format, but it takes the form:

Code:
symbol state b28
symbol oldstate b36

main:
gosub readinputs <some ADC vals, returns>
gosub workonstate <checks state value, does some conditional items, returns>
oldstate=state <copies old state>
gosub morework <modifies actions and changes state if required, returns>
goto main
but at no point does the value of "state" change.
 

hippy

Technical Support
Staff member
This seems to be some peculiar interaction between symbol definitions and the simulator updating variable displays which we will investigate ...

#Picaxe 28x2
Symbol state = b28
Do
state = 2
Loop

In the meantime the best workround is to use variables which do work. Please accept our apologies for the problem.
 
Top