LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Notifier - for loop

Solved!
Go to solution

I can see two solutions

 - state mahine, and a producer/consumer, (maybe with at double producer/consumer), and with no for-loop.

- A producer/consumer with only one statemashine in the consumer calling the right vi's in correct order using a for-loop. 

 

But you have not shown how you have develop your talk to the motors or to the laser.

 

 

 

0 Kudos
Message 31 of 60
(1,968 Views)

Your code won't get going until you have the Laser LED value change event happen.

 

That event can't happen because LED laser is an indicator, meaning no person is able to trigger the event by pressing on it, nor is there any Laser LED Value Change(Signalling) property node in your VI for the VI to programmatically fire the value change event.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 32 of 60
(1,938 Views)

@dkfire wrote:

I can see two solutions

 - state mahine, and a producer/consumer, (maybe with at double producer/consumer), and with no for-loop.

- A producer/consumer with only one statemashine in the consumer calling the right vi's in correct order using a for-loop. 

 

But you have not shown how you have develop your talk to the motors or to the laser.

 

 

 


@dkfire wrote:

I can see two solutions

could you specify which procedures are you thinking to be implemente in each solution?

I need the FOR loop for adquiring the parameters from a spreadsheet file (.txt).

 

But you have not shown how you have develop your talk to the motors or to the laser.

 

that's the issue I can't solve yet.....as you can see from my previous attached files and images, I am stuck in solving how to go from a "paused" FOR loop into a "laser execution" and then coming back to the "paused" FOR loop to continue iterating.

 

Both, from the motor process, and from the laser process, I have a reg event callback trigger that can let me know when the processes finishes. So I was thinking in using Notifiers as a solution for that <<talk>> but still is not working.

 

I think maybe I should change the way I am accesing the reading of each row, instead of using a FOR loop use something else. In that case, I wouldn't need a "pause".

 

 

0 Kudos
Message 33 of 60
(1,926 Views)

@RavensFan wrote:

Your code won't get going until you have the Laser LED value change event happen.

 

That event can't happen because LED laser is an indicator, meaning no person is able to trigger the event by pressing on it, nor is there any Laser LED Value Change(Signalling) property node in your VI for the VI to programmatically fire the value change event.

 


In my program, I use an reg event callback to trigger the events. In simpler (and shorter) programs, I change those triggers by buttons, just to see if it could work. (i know is not the same in terms of proper definition of event).

 

But in that case, I need to wait the event to be triggered just to continue to the other process....and event triggered LEDs was an idea to use in events structures....

 

I sure use the LED value change property, for keeping ON or OFF the led state: 

 

but still in the same situation:

 

ledProperty.png

0 Kudos
Message 34 of 60
(1,916 Views)

In that image, all I see you using is a Value property.  I don't see you using the Value (Signalling) property.

 

Seeing the multiple event structures in your code scares me.  In general, that is a bad idea.  Unless you really know what you are doing, your are bound to mess them up.

 

I'd recommend reading Caveats and Recommendations when Using Events in LabVIEW.

0 Kudos
Message 35 of 60
(1,909 Views)

I would have:

  • One Producer for User events. This is linked to the Motor Producer with a queue.
  • A Motor Producer that is a state mashine, that can accept instruction from the Event producer and the Laser Consumer with queue.
    • In one state it can extract an element from you array and process that and then send instruction to the Laser Consumer.
  • A Laser Consumer that is a state mashine, that can accept instruction from the Motor Producer and send back instruction to the motor.

You DO NOT need a for-loop for processing an array one element at a time.

 

I do not think that a Reg Event Call back is right for you.
( Don't take this the wrong way, but by the level of LabVIEW that you have shown in the code posted so far, Reg Event Callback is way over that level, and can be implemented very wrong)

 

And to me it sounds like you already have implemented the motor process, so why don't you show us that?

 

0 Kudos
Message 36 of 60
(1,905 Views)

@dkfire wrote:

I would have:

  • One Producer for User events. This is linked to the Motor Producer with a queue.
  • A Motor Producer that is a state mashine, that can accept instruction from the Event producer and the Laser Consumer with queue.
    • In one state it can extract an element from you array and process that and then send instruction to the Laser Consumer.
  • A Laser Consumer that is a state mashine, that can accept instruction from the Motor Producer and send back instruction to the motor.

You DO NOT need a for-loop for processing an array one element at a time.

 

I do not think that a Reg Event Call back is right for you.
( Don't take this the wrong way, but by the level of LabVIEW that you have shown in the code posted so far, Reg Event Callback is way over that level, and can be implemented very wrong)

 

And to me it sounds like you already have implemented the motor process, so why don't you show us that?

 


You DO NOT need a for-loop for processing an array one element at a time.

 

if not, how can I read each row at a time and wait to send the parameters to the motor process?

 

I do not think that a Reg Event Call back is right for you.
( Don't take this the wrong way, but by the level of LabVIEW that you have shown in the code posted so far, Reg Event Callback is way over that level, and can be implemented very wrong)

 

Unfortunately, It was not something I picked to use, it is because both of the machines that I am controlling are based on Active-X commands, so Reg Event callback are needed.

 

And to me it sounds like you already have implemented the motor process, so why don't you show us that?

 

Because I see that is irrelevant to show ALL my code, where my problem is not going to be solved to be showing that. As I said before, I am stuck at solving a case where some parameters are readed from a row in a file, and then use it in a motor-moving process.

0 Kudos
Message 37 of 60
(1,866 Views)

@RavensFan wrote:

In that image, all I see you using is a Value property.  I don't see you using the Value (Signalling) property.

 

Seeing the multiple event structures in your code scares me.  In general, that is a bad idea.  Unless you really know what you are doing, your are bound to mess them up.

 

I'd recommend reading Caveats and Recommendations when Using Events in LabVIEW. great recommendation!!


Thanks RavensFan. That's is why my consumer event structure was never triggered. Now it does 🙂

 

I think I can prescind from the Notifier, because I can used event structures instead.......(I should have 4 structures, START, STOP, MOTOR finished, LASER FINISHED).

 

I will create a state machine to make a "cleaner" program, so instead of multiple event structures, what can be used?

 

 

0 Kudos
Message 38 of 60
(1,831 Views)

@Stavrosyt wrote:

@RavensFan wrote:

In that image, all I see you using is a Value property.  I don't see you using the Value (Signalling) property.

 

Seeing the multiple event structures in your code scares me.  In general, that is a bad idea.  Unless you really know what you are doing, your are bound to mess them up.

 

I'd recommend reading Caveats and Recommendations when Using Events in LabVIEW. great recommendation!!


Thanks RavensFan. That's is why my consumer event structure was never triggered. Now it does 🙂

 

I think I can prescind from the Notifier, because I can used event structures instead.......(I should have 4 structures, START, STOP, MOTOR finished, LASER FINISHED).

 

I will create a state machine to make a "cleaner" program, so instead of multiple event structures, what can be used?

 

 


How about making one event structure for all?  Use a QMH and just enable/disable the buttons as needed?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 39 of 60
(1,804 Views)

@billko wrote:

How about making one event structure for all?  Use a QMH and just enable/disable the buttons as needed?


Hello again,

 

That's a good suggestion. I will do a state machine based on driven events. So a case structure ,inside a event structure, inside a while loop.

 

About the enable/disable buttons, maybe is enough using the same event structure instead of Queues as you suggest. Do you have an example for the Queued Message Handler for enabling/disabling buttons?

 

 

0 Kudos
Message 40 of 60
(1,755 Views)