Jump to content

Spetz

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Spetz

  1. Not sure this works quite right. Why does the "button 1" only work one time?
  2. Ok got it. So in this particular case does it make sense to use events vs just using a case structure in the timing loop? Is there any benefits?
  3. Ok great thanks this does seem to work. However i see the event loop is still iterating so doesn't this negate the point of the event loop and the computing benefits of not polling that loop every time? Is there a better way to achieve what i'm trying to do? Is there documentation on how to use the old and new value?
  4. Hi Thanks for the reply. I'm not sure i understand your point 2a. completely. Where does the case structure go? Does that end up inside event loop and inside the event case to actually trigger the message?
  5. Hello all, i'm just starting out so any help is appreciated. Two question "1" is general and "2" is specific. 1. When an event structure is in a while loop the while loop only iterates when the event occurs. What is the reasoning behind this and why can't a single while loop contain other code that gets polled or executed with every iteration? 2. I'm having issues with the attached code. Two main issues that i don't quite understand. I'm trying to have make a code that will do several things on the front panel at particular time intervals. I would like it to throw up a message to the user and also enable and disable some controls. While all of this is happening i will be collecting data and doing some PID control on the some IOs. The full code is not attached but basically my plan is this. One loop for PID and DAQ functions. Loop 2 for event structures such as messaging and enabling and disabling controls etc.... Loop 3 for timing of the user input. What i'm having trouble with is loop 2 and 3 which is what's in the attached in the simplified form. a. When button1 is pressed and action is set to "switch until released" my message 1 appears twice. This makes sense as the button switches from F to T to F. How do i get the even to trigger only one time on the press of the button if i want the button to be momentary? I can get this to work when i switch the action to "latch" which makes sense because it changes state once per click?!?! Also when i connect an LED to that button the LED never goes off once it's turned on, whats the explanation here? b. The biggest mystery to me is the timing in Loop 3. I'm using the "time has elapsed" output of the elapsed time VI to trigger the event and pop up message 2. If this was working correctly i suspect that the message would pop-up twice as this goes from F to T to F. But the event is triggered continually and i'm not sure why? Based on the indicator it should only trigger once every 10seconds not every loop iteration. Also there is an element of question "a" here when this is working correctly how do I trigger only one event based on the FTF output of elapsed time? What is the proper way of programming this and what am i doing wrong/missing? Appreciate any help or guidance. Event_timer.vi
×
×
  • Create New...

Important Information

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