Author Topic: Exlicit control over timing, and number of times executed?  (Read 3572 times)

ET

  • Guest
Exlicit control over timing, and number of times executed?
« on: November 19, 2012, 06:16:10 PM »
In a regular programming environment, with a normal programming language, you know exactly which order statements will execute, and how many times they will execute.
(They only execute once, unless you put them inside of a loop, for example.)
In GUIDE, the components are updated every program loop, which effectively means that they are updated continuously, in real time.
99% of the time, this is what you want.
For example, a motor which turns a cooling fan needs to have its speed and power smoothly updated, based off of the temperature of the thing it's cooling.
However, you get problems when you want to have a sub-page's logic executed exactly once, followed by another thing being executed exactly once.
For example, if I need to get the nth item from an array, then do some logic on it to find the index of the next item in the array to process, I'll be unable to do so.
Since components are executed continuously, there's no way that I can see, to tell the program "execute X, then once it's done, execute Y with the result from X".

Are there any tools in GUIDE to do easily this?
I can't seem to find any.

Offline Richard

  • PLUS+1 Expert
  • ****
  • Posts: 64
  • Karma: +1/-0
    • PMC Harvesters
Re: Exlicit control over timing, and number of times executed?
« Reply #1 on: November 19, 2012, 06:35:02 PM »
Have you tried to achieve this using modules?  Logic in a module can be run based on a bool signal outside of that module.  I believe though that if you wanted the main logic to cease during running of the module you'd have to put your main logic in a module too so it can be stopped.

I don't use modules myself apart from when driving a printer in older versions that made navigating through the application EXTREMELY slow.

ET

  • Guest
Re: Exlicit control over timing, and number of times executed?
« Reply #2 on: November 19, 2012, 10:11:16 PM »
Sounds like it might work; will give it a shot.

ET

  • Guest
Re: Exlicit control over timing, and number of times executed?
« Reply #3 on: November 20, 2012, 11:05:29 PM »
Modules do not appear to be a workable solution because you can only have one instance of them in your main program, and they operate continuously, without a way to easily run them just once.
Are there any other possibilities?

Offline Richard

  • PLUS+1 Expert
  • ****
  • Posts: 64
  • Karma: +1/-0
    • PMC Harvesters
Re: Exlicit control over timing, and number of times executed?
« Reply #4 on: November 22, 2012, 01:21:41 PM »
Sorry ET,

Using modules was the best I can suggest.  Maybe this is one for the helpdesk.

Richard

Brian Bandura

  • Guest
Re: Exlicit control over timing, and number of times executed?
« Reply #5 on: May 21, 2013, 05:38:15 PM »
Have you considered using a rising edge on a variable with the logic controlled by that?  Then when you turn on the variable it will exicute only the one time which could set another variable etc. To run it the next time you would have to toggle them off then start the sequence over again.

Just a thought.

Brian Bandura
DFI Corporation