Hi,
I have a strange issue in a sim(debug), I have a couple of LED's and when I run the sim for the first time everything seems to work as expected.
If I stop the sim and run it again the LED's are the same state as when it was stopped, I have even tried turning them off at the start of the program but that does not work either.
Also, if I put the variables $PORTA2 and $PORTA3 in the watch list they do not change.
Here I have run the program and stopped it with both LED's on after around 16 seconds (SimTime), on the second start they should both be off?
If I reload the program all is OK again until it is run and stopped.
Regards,
Bob
LED state in simulation (debug)
-
- Posts: 279
- http://meble-kuchenne.info.pl
- Joined: Sat Mar 19, 2022 4:53 pm
- Has thanked: 25 times
- Been thanked: 30 times
-
- Valued Contributor
- Posts: 1205
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 292 times
- Been thanked: 424 times
Re: LED state in simulation (debug)
Hi
Whilst I know of LEDs not reinitialising when simulation has been stopped and restarted, I've not came across it not responding to being told to switch off at the start.
Perhaps to narrow it down could you set the pins off (e.g. set output of B1 = 0 or such like)?
Regards
Whilst I know of LEDs not reinitialising when simulation has been stopped and restarted, I've not came across it not responding to being told to switch off at the start.
Perhaps to narrow it down could you set the pins off (e.g. set output of B1 = 0 or such like)?
Regards
Re: LED state in simulation (debug)
Hi,
I tried that but no difference. What did puzzle me was the pins i used were not in the output list so I changed them but still no good.
Hope to try on real hardware soon.
Bob
I tried that but no difference. What did puzzle me was the pins i used were not in the output list so I changed them but still no good.
Hope to try on real hardware soon.
Bob
-
- Matrix Staff
- Posts: 1288
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 170 times
- Been thanked: 289 times
Re: LED state in simulation (debug)
I've tried simulating your project and I do not see the problem you are describing (unless I misunderstand you).
When I single-step through the project and set 'ReadRequired' to 1, the LEDs both come on within the call to 'Outputs'. The 'Digital Pins' window show pins A2 and A3 at logic 1 and list the LED they are connected to.
When I stop and run your program again, the LEDs switch off and those pins are set to zero when the 'TurnOff' macros are executed. This happens if I step through the simulation and when I run it normally.
I notice you are using the Legacy 2D panel. We don't recommend using this in v10 and you would be better to move the components to a new 2D panel.
When I single-step through the project and set 'ReadRequired' to 1, the LEDs both come on within the call to 'Outputs'. The 'Digital Pins' window show pins A2 and A3 at logic 1 and list the LED they are connected to.
When I stop and run your program again, the LEDs switch off and those pins are set to zero when the 'TurnOff' macros are executed. This happens if I step through the simulation and when I run it normally.
I notice you are using the Legacy 2D panel. We don't recommend using this in v10 and you would be better to move the components to a new 2D panel.
Re: LED state in simulation (debug)
Hi Steve,
I did a library update and it now works as expected, also I found the digital pins window, never noticed it before.
I cannot find out how to change the 2D panel without deleting everything and starting again?
Bob
I did a library update and it now works as expected, also I found the digital pins window, never noticed it before.
I cannot find out how to change the 2D panel without deleting everything and starting again?
Bob
-
- Matrix Staff
- Posts: 1480
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 525 times
- Been thanked: 481 times
Re: LED state in simulation (debug)
Hi, Bob.
No need to delete anything.
After you have added one or more 2D panels, if the component is a 2d component, then just right-click on it and select Move to.
Then select the name of the panel you would like to move it to.
If you have 3D components, you can add the equivalent 2D component then delete the 2D component you just added as it will now be in Flowcode's memory.
Right-click the component, then select Selection > Replace
The 3D component should now be replaced with the 2D conversion, if compatible.
No need to delete anything.
After you have added one or more 2D panels, if the component is a 2d component, then just right-click on it and select Move to.
Then select the name of the panel you would like to move it to.
If you have 3D components, you can add the equivalent 2D component then delete the 2D component you just added as it will now be in Flowcode's memory.
Right-click the component, then select Selection > Replace
The 3D component should now be replaced with the 2D conversion, if compatible.
Martin
Re: LED state in simulation (debug)
Hi Steve,
I have managed to move the components to the new panel but in my dabbling I managed to add a 3d panel which I cannot get rid of.
It has a red exclamation mark in the box to the left. Not sure what has happened but now it has the 3 boxes like the 2D one but still cannot remove it.
Bob
I have managed to move the components to the new panel but in my dabbling I managed to add a 3d panel which I cannot get rid of.
It has a red exclamation mark in the box to the left. Not sure what has happened but now it has the 3 boxes like the 2D one but still cannot remove it.
Bob
-
- Matrix Staff
- Posts: 1480
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 525 times
- Been thanked: 481 times
Re: LED state in simulation (debug)
Hi Bob.
No, you did not add the 3D System panel, its there by default, so it can't be removed.
The red exclamation mark just means its hidden.
The same can be done with any 2D panels as you can have more than one.
Just right-click on any panel for options e.g. Hide/Unhide (2D panels allow you to rename them as well).
Wiki has information on 2D Panels.
No, you did not add the 3D System panel, its there by default, so it can't be removed.
The red exclamation mark just means its hidden.
The same can be done with any 2D panels as you can have more than one.
Just right-click on any panel for options e.g. Hide/Unhide (2D panels allow you to rename them as well).
Wiki has information on 2D Panels.
Martin