VSM jumpy behavior + step mode jumpy highlight line pointer?

Protezoid

New Member
I just bought VSM and have been trying my first simulation and so far i need a Tylenol extra headache patch to my forehead. I wrote a program for 08m2 to control a two line lcd1602 display so i can understand how these nice displays work. I assume that my program works fine since the Picaxe editor has simulated it without problems. It was tested step by step which shows the program's highlighted line pointer moving correctly with the logic and giving good values for variables ect... Now i load it in VSM with the circuit and the step mode program highlighted line pointer jumps without sense to various lines of the program...

Ok it might be my circuit so i reduced it to just one Picaxe 08m2 and the same thing happens? Why is it good in the Picaxe step mode editor and in VSM it's chaos? I did an update on the VSM models like it is written for v 7.1 and still the same. I have read the 5 tutorials.

Now i did a simple circuit and program with a 08m2. The circuit has the usual
picaxe socket and only a switch at pin c.1. Thats it . the program is this:

#picaxe 08m2
main:
for b0 = 1 to 20
if pinc.1=1 then goto main
high c.2
pause 100
low c.4
pause 200
next b0
goto main

Again in step mode, the highlighted simulated pointer that shows the line of code executed keeps jumping in a non step by step fashion with this simple program. First the line of the 'for' command is highlighted, then on the next step the 'pause 100' and after pause 200. After that it keep toggling between the two pause command lines. I don't understand why the step mode behave this way. It does not step one line at a time like it should. Visually, it's confusing, not user friendly and impossible to follow with more complex program. Now i have checked some demos included with VSM they also do not show a regular step by step highlighted line pointer on execution, it is jumpy and not like Picaxe editor...

So far, my initial lcd program is jumping without logic in its code is visually impossible to follow in vsm step mode, plus all vsm demo programs in step mode show a jumping highlighted line pointer in VSm. I have read a thread on a similar jumpy program problem but the example in the thread was a bit complex to follow. Do i have a buggy installation or is this bad software design because the free Picaxe editor works super fine contrary to the $80 (CAN) VSM ? Can someone explain this?

Andre
 

hippy

Technical Support
Staff member
I did an update on the VSM models like it is written for v 7.1 and still the same.
Are you using PICAXE VSM as downloaded from our web site or some other version of Proteus/VSM ?

When I test your program with my PICAXE VSM, simulation runs fine and your program single steps as would be expected; I do not see any jerkiness or it jumping lines.

Do you have a link to the other thread which related to a similar problem as that may help clarify what is going on. I am not overly familiar with VSM, and have not used it for a while, so it may be something to do with the way it has been configured.
 

Protezoid

New Member
VSM jumpy behavior

Are you using PICAXE VSM as downloaded from our web site or some other version of Proteus/VSM ?

When I test your program with my PICAXE VSM, simulation runs fine and your program single steps as would be expected; I do not see any jerkiness or it jumping lines.

Do you have a link to the other thread which related to a similar problem as that may help clarify what is going on. I am not overly familiar with VSM, and have not used it for a while, so it may be something to do with the way it has been configured.
Thank Hippy for reply, glad to hear that it works fine on your side.

I downloaded the program from the picaxe vsm web site and ran it as a demo for a couple of days then i bought the license but i had to remove the installed version to get the license manager window at the beginning of the vsm reinstallation procedure. Then i registered the license and vsm worked as a registered copy.

Last night, i did some detective work and found the vsm worked for a while in regards to the values in variables but the highlighted line pointer in step mode was like jumping steps. Then i connected a virtual oscilloscope which show good working signals in step mode. Then later i would active the step button and nothing would change, no variable, no wire color change and no oscilloscope. After many clicks, multiple pulses suddenly appear on the oscilloscope (because pulsout were in a FOR-NEXT 0 to 7 loop) and variables show values instantly but do not make sense..

Yes i have read a similar 'jumpy vsm' thread but the example program in the thread was very complex and i did not find answers, i will look again. If you see something similar to this please send me the thread link. This seems very technical.

Is there a setting to adjust the step mode in VSM? it seems to behave like a FOR-NEXT with a STEP 5 or 10...

i uninstalled VSM and reinstalled it but still the same for jumpy step mode... :(

I checked the time frame at every push of the step button, maybe the simulation jumps in time rather than in steps(?), here is the data for the test little program we tested earlier:

#picaxe 08m2
1......main:
2......for b0 = 1 to 20
3......pinc.1=1 then goto main
4......high c.2
5......pause 100
6......low c.2
7......pause 200
8......next b0
9......goto main

First push step button, VSM time= 0.1ms ----highlighted line pointer of program is shown at line 2 -(for next)
second push............., VSM time= 50.1ms ---- highlighted line pointer of program is shown at line 5 -(first pause)
third push................, VSM time= 100.1ms - highlighted line pointer of program is shown at line 7 -(second pause)
fourth push.............., VSM time= 150.1ms - highlighted line pointer of program is shown at line 5 -(first pause)
third push................., VSMtime= 200.1ms - highlighted line pointer of program is shown at line 7 -(second pause)
(repeats between the two pauses with 50ms increment... ...)

Do you have same time values? DO these make sense?
Anybody understand this jumpy behavior?

Thanks for help
Andre
 
Last edited:

Protezoid

New Member
Hippy, i'm writing more info, i did some research in VSM help. If you type 'single stepping' and select 'source level debugging' in the help index found choices, you will see a document with a section about 'single step'. There are 4 step mode, these can be seen also in debug top menu or in the program window (top right) as 4 'human feet' stomping in different fashion. These are:

Step Over - advances by one line, unless the instruction is a sub-routine call, in which case the entire subroutine is executed.
Step Into - executes one source code instruction. If no source window is active, it executes one machine code instruction. These are usually the same thing anyway unless you are debugging in a high level language.
Step Out - executes until the current sub-routine returns.
Step To - executes until the program arrives at the current line. This option is only available when a source code window is active.

i wrote another small program to understand these type of step mode. here it is:

#picaxe 08m2
main:
b0 = 0
for b1 = 1 to 20

inc b0
pause 50
inc b0
inc b0
inc b0

gosub reduce
next b1
goto main

reduce: ;.......................

dec b0
dec b0
dec b0
dec b0
return

With this program, i tested VSM again and the highlighted line pointer in step mode starts at the top (b0=0) and jumps right away to the pause line and stays there without moving for all pushes of the step icon...with time steps of 50ms each. This is bizarre...I cannot identify what step mode is assigned to the step icon of VSM.

Now i tried the 4 step mode with the program above to see the difference and to my surprise 'Step Over' mode does steps, line by line but does the total gosub procedure in one step, just like it says. After i tried 'Step Into' which seems to do a full step mode within the gosub subprocedure as well. This is the true step mode it seems. The third ends the debug session right after the gosub return...

These 4 step mode are 100us each at every steps but not the main step icon which is 50ms per steps! What the hell is that step mode assigned by default to the main step button of the interface and why 50ms instead of 100us???

Ok, no big deal, i will remap that button to fix this and went in the keyboard mapping option to change the bogus step mode assigned but strangely all the button are there (play, stop, pause) but not the step icon(?!) It cannot be reasigned, this is even more bizarre...I assigned the space bar instead as a temp solution.

Hippy, is there a way to send me a config file of your keyboard mapping so i can overwrite mine, maybe my step button will be behave like yours. I don't know what to do to fix this. I hope that's the only bogus function too, i just bought the license and already crashing in a major bug.. i have done the most that i can to fix this bug, i would like the satisfaction of knowing that i have a good working software :( ?

What do you think is going on? Anybody else have an idea?
thanks!
 

hippy

Technical Support
Staff member
I think I understand the issue and it seems to be in understanding VSM operation.

The main simulation controls at the bottom of the window ( Play, Step, Pause, Stop ) controls circuit simulation during which time the PICAXE program will free-run so Step means it can end up at any line at the end of each Step.

When simulating code the buttons for the source code window ( Run Simulation, Step Over, Step Into, Step Out Of, Run To ) execute one or more source lines and provide a period of time for which the circuit simulation is run.

The jerkiness and jumping comes down to using the main circuit simulation Step button, rather than the code simulation Step Into button. Everything seems to be working exactly as would be expected.

The best way to simulate source code is to click on the main Step button once, then, after the source code window appears, ignore that Step button, and click on the Step Over / Step Into buttons.
 

roho

Member
Hi Andre,

It's important to understand that VSM is a mixed signal simulator, meaning that it has an analogue part and a digital part, and some method of synchronising the two. The functioning of these two parts is very different and, as hippy surmises, this seems to be causing your confusion.

Simulation is started using the START button in the bottom left hand corner of the schematic window. I believe that it is the button next to that that you refer to as the STEP button. This is not a STEP button (at least not in the sense that you are used to from the PICAXE Editor) but a button that advances the analogue engine one animation frame. As hippy states, your programme code free runs during this time (unless you have a break point set) and the actual line of code to be executed when this advance of time ends will be wherever the programme has reached. This is highly likely to be a PAUSE statement.

In fairly basic terms, you can think of the controls at the bottom left as controls for the analogue part of the simulator, while those at the top right are for the digital part. You can learn quite quickly how to control interaction between the two.

From what you and hippy have described, it's almost certain that VSM is behaving properly and I'm sure with a bit of practice you'll get to grips with it very quickly.

Roger.
 

Protezoid

New Member
Thanks for reply on this guys! Yes this does create a confusion between PE and VSM. The bottom left buttons seem to act as a free run based on time rather then steps like the 'foot stumping' icons at the top right of the debug window. It feels like a bug when you have been using PE for some time. Not a smooth start for a new beginner with VSM. I have programmed the space bar with the digital 'step into' mode and it glides well in the code now. I can do simulations with no problems.

Besides the VSM help files, where could i find more detailed info or tutorials on using VSM and better understand the software and interface? I have read the beginner's 5 pdf basic tutorials but i'd like to learn much more? I want to complete a project by exporting to a pcb software but i have to edit footprints like the 16 pin lcd 1602A but VSM has the 14 pin LM016L which is very similar but does not have the A & K (pin 15 and 16) for led backlight...

Honestly, PE and VSM combo are really addictive!
Thanks for support!
Andre
 
Top