Simulation Panel

catalina

New Member
My programme uses a number of 'if ..then' statements using the variable b1. Simulation runs ok with what appears to be the default b1 value of 0. I can pause the simulation and by double clicking on the b1 variable in the simulation panel change its value. However, when continuing the simulation b1 defaults to 0 again.

The manuals make no reference to panel settings. Can anyone offer guidance on these settings or point to a source of help?
 

Technical

Technical Support
Staff member
Seems to work ok for us, as long as you pause/continue. Naturally when you stop/start a program the variable will reset to 0, as on a real chip.
 

catalina

New Member
Technical, am still having trouble with altering variable values during simulation.

I can't find the pause/continue facility you mentioned. The 5.2.0 version of Programme Editor I'm using offers single step and run but no pause.

Is there documentation available to explain the several settings in the Simulation Panel?
 

eclectic

Moderator
Weenip

Do you mean the > symbol, which changes to || (and goes red)?

Manual 1 pages 48 to 50 give info.

e

Or have I read the question wrongly?
 

Technical

Technical Support
Staff member
As eclectic says, the second button down will either
1) force a break (if program is running)
2) or continue from the break point (if in a break)

When you continue the variable value will be as altered (double click on variable value to change).

The break can also be caused by a breakpoint in the program (double click over the line number in the margin to set a break point - indicated by a red bar). In this case the second button down can be used to continue the program from that point.
 
Last edited:

catalina

New Member
Thanks for the responses. Still no joy.

I've attached the programme as I suspect there may be an omission within it. When stepping in simulation the value of b0 reverts to zero each time the first 'if ... then' statement is reached.

Would someone kindly comment on the programme? Its syntax is ok.
 

hippy

Technical Support
Staff member
I'm guesing it's "count 3, 1000, b0" which rsets b0. Have you alterted the Generic Value ? Seemed to work okay when simulating for me.

You'll also want to change your IF code as it doesn't do what you're probably after ...

Code:
if b0 >1 and b0 <2 then set1	'jump to sub-procedure labelled set1
if b0 >2 and b0 <3 then set2	'jump to sub-procedure labelled set2
if b0 >3 and b0 <4 then set3	'jump to sub-procedure labelled set3
None of those will ever resolve as true; you cannot have an integer greater than one which is also less than two etc :)
 

catalina

New Member
Thanks for joining the discussion Hippy.

I take your point on the integers. The 'if...then' statements have been widened by doubling the count period. The problem remains however, with the simulation still limited to the b0 = 0 step. I'm not clear on the Generic Value. Setting its value in the Panel (seems limited to increments of 50) caused the simulation to step through the main: and set0: sections of the programme.

I am flying blind on these Panel settings at the moment. It appears the variables section is a window on how the variables change as the programme runs, with no ability to alter the values during simulation. Would you be kind enough to explain how to use the A1,A2,A4 and Generic Value settings on the Panel?

It seems the underlying problem is that input3 is never reading anything but 0. Maybe the way to verify the programme is to load it into an 08M running in a simulated VSM schematic, with a pulse generator giving a sensible input 3 to the Pixace for it to count.
 

Attachments

hippy

Technical Support
Staff member
I'm not clear on the Generic Value. Setting its value in the Panel (seems limited to increments of 50) caused the simulation to step through the main: and set0: sections of the programme.
The important thing here is does b0 keep the generic value whenever the program hits the first IF ? If so you're on the way to debugging the rest.

It took me a while to work out how to get anything other than steps of 50. Click on/in the box which shows "50", then use delete/backspace and type in the number you need. Alternatively, change the ranges for the IF statements so the 0/50/100 values alter program flow as required.
 

catalina

New Member
Good one Hippy - that worked.

I'll have to massage the programme somewhat as some integers are not being identified.

I would still like information on using the A1, A2 and A4 keys ; nothing results from a forum search. Perhaps Technical would offer a tutorial.
 

Technical

Technical Support
Staff member
A1, A2 and A4 are used within the readadc command only. They set the analogue value (0-255) of the variable after 'readadc' is processed on the appropriate input.

Other various commands, such as count, take the 'generic' value when they are varied. If you have more than one command that takes the generic value it is better to put a breakpoint in that line and manually change each time.
 

Technical

Technical Support
Staff member
The main issue is that you have also not changed the problem in your code that Hippy highlighted

If b0 > 1 And b0 < 2 Then set1

this is nonsense - it will never be true - e.g. if the value is 2 it is greater than 1 but not less than 2!

We guess you really mean

If b0 = 1 Then set1
 

catalina

New Member
Thanks Technical for the A's information

My post of May 18th shows that Hippy's suggestion was adopted, The 'if..and...then' statements were widened and, as the programme developed further, the byte variables were changed to word variables.
 

Technical

Technical Support
Staff member
post 10, 18th may still has the line

'If b0 > 1 And b0 < 2 Then set1' in it, so there is a mismatch somewhere!
 
Top