Jump to content

Timed Loop for non-windows?


jccorreu

Recommended Posts

QUOTE(jccorreu @ Aug 9 2007, 11:50 AM)

I'm using 7.1 and working on code in which the previous guy put the windows-only timed loop function. I also develop on mac and linux and am wondering if 8.anything has made this for those platforms as well.

thanks

james

You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one.

George

Link to comment

QUOTE(george seifert @ Aug 9 2007, 10:02 AM)

You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one.

George

Aah, but if you need the new multi-core functionality on LV-RT (or possibly LV) where you can target a specific timed loop to a specific processor core, you are stuck using them.

Still scratching my head as to how to implement a state-machine using a timed loop.. does it even make any sense doing that?

Neville.

Link to comment

QUOTE(george seifert @ Aug 10 2007, 03:02 AM)

You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one.

I don't think it's fair just saying that without either explaining why or linking to somewhere that goes into detail.

Link to comment

QUOTE(george seifert @ Aug 9 2007, 11:02 AM)

You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one.

George

I never looked at the timed loop before because it is platform-dependant in 7.x. I won't use platform-dependant functions when I code, unless I have version for each of the platforms I'm developing on/for and then I just call which one is necessary. But I digress.

I know next to nothing about the timed loop because of this. Bad form since I've got one as the fundamental loop in the master control program, that I've inheritted from someone who never told me why he wanted to use it. So if you'd point me to some good eduactional source on this it'd be great. And not just some long winded discussion, but something used to teach us newbies. :>)

Again the point I really want to emphasize is that I want to replace it. Because I am using 7.1.1, NOT 8.x, It does not work on MAC and Linux, which makes for a very difficult time for me :>) I've already started playing with ways to emulate some of the functionality from scratch which I'll post over the weekend (i think). But if I can avoid doing what someone else has already done, I'd rather. Its a lost opportunity to learn a little more, but then again seeing what more advanced coders do is always teaching me anyway. And they often make much more elegenat clean efficient extensible code.

james

Link to comment

I never got an answer as to whether or not 8.x has the platfrom-independant timed loop, or if its still a windows-only component.

OK so here is my attempt to create from scratch a basic timed loop along the lines of 7.1.1 that is platform independant. As I find more need for functionality I'll add it then. Anyone is welcome to make more of this. Any comments, critiques, suggestions, etc are welcome. IF it becomes useful lets add it to OpenG library.

This might belong in a different forum category for here on.

james

http://forums.lavag.org/index.php?act=attach&type=post&id=6649

Link to comment

well the case and wait is not going to cut it either. when they are running by themselves with no real program they're ok, but when I attempt to use them in a full scale project with multiple vi's running multiple loops, well it falls short.

sometimes there is up to a 30ms pause between the time the wait period is calculated and the time that the wait function is called. i've attempted to get around it as you can see in this .vi but its just not working. i suspect its because of the way the system handles doing multiple processes, cycling amongst them all, and sometimes it hands of the processor to another routine right in the wrong portion of my code. Does anyone know of a way to force labview to go through a section of code without letting any other process interupt? I was hoping putting that little bit in a sequence might, but now I think of it, theres no reason they should have given it that special status.

james

http://forums.lavag.org/index.php?act=attach&type=post&id=6686

Link to comment

QUOTE(Neville D @ Aug 10 2007, 04:51 PM)

Aah, but if you need the new multi-core functionality on LV-RT (or possibly LV) where you can target a specific timed loop to a specific processor core, you are stuck using them.

Still scratching my head as to how to implement a state-machine using a timed loop.. does it even make any sense doing that?

Neville.

It only really makes sense if you want to executes states at a specific rate (maybe not very likely), or if you want to run your state machine on a specific processor. In that case you can just set your Timed Loop period to zero and use it somewhat like a regular while loop. There will be some extra overhead in this approach versus a regular while loop.

If you want to be able to run your state machine on a specific processor in LV85, another option is to put your existing state machine with a regular while loop inside a single-frame Timed Sequence Structure and set its processor affinity. This is simpler and probably has less overhead than the option above, but this option won't let you dynamically change processors while your state machine executes.

Link to comment

QUOTE(jccorreu @ Aug 20 2007, 03:25 PM)

In a state machine, you could easily calculate the elapsed time on each state and decide what to do about it (select next state based on this).

I don't think you need a "timed loop" structure per se, unless the timing granularity required was very high.

The notifier-based approach you have will only work if you have one of these loops. Notifiers of the same type interfere with each other, and cause some of the notifiers to be missed; this is due to performance optimizations in the NI code for notifiers. This is not a bug. You would be better off using a single element Q, instead of the notifier, if you really wanted to implement this architecture.

Neville.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.