Jump to content

Need help in programming!


athalia

Recommended Posts

Hi all!

I got a problem here.I need to join these two attached VIs.

Original state GREEN light on.

Press Submit---> RED light l& soilnoid on.

Upon Collection

Press Submit---> RED light & soilnoid off---->Back to green on.

Any help i appreciated!

THANKS!!!smile.gif

To be honest I don't understand what you want to do exactly so it is difficult to give you help on the functional requirements. However, there are several things you can do to help clean up your code. First, I think you may want to separate the user management functionality from the control of the solenoid. Creating new users should have no effect on the operation of the solenoid, at least not in most applications. Operation of the solenoid would require the user to be validated and only allow a valid user to control it. This type of flexibility can be achieved using a traditional producer/consumer architecture. One loop will contain your event structure and process the UI events. You may also use user defined events if required. The second parallel loop would contain a queued state machine which would receive commands/actions from the producer (UI loop) to indicate a new user has been created, a user is logging in, they are attempting to control the solenoid. Using shift registers you can maintain the appropriate state information in your consumer loop for whether a user is logged in or not as well as the current state of the solenoid. You can disable the control to turn the solenoid on or off depending on whether the user is logged in or not.

If I get some time later I can try to put together a quick example of this architecture. In the meantime you can look at the examples for the producer/consumer architecture in the NI examples.

Unless I completely misunderstand your requirements I think you you mixing functionality (adding users, validating users, and controlling the solenoid) which will overly complicate the application.

Link to comment

To be honest I don't understand what you want to do exactly so it is difficult to give you help on the functional requirements. However, there are several things you can do to help clean up your code. First, I think you may want to separate the user management functionality from the control of the solenoid. Creating new users should have no effect on the operation of the solenoid, at least not in most applications. Operation of the solenoid would require the user to be validated and only allow a valid user to control it. This type of flexibility can be achieved using a traditional producer/consumer architecture. One loop will contain your event structure and process the UI events. You may also use user defined events if required. The second parallel loop would contain a queued state machine which would receive commands/actions from the producer (UI loop) to indicate a new user has been created, a user is logging in, they are attempting to control the solenoid. Using shift registers you can maintain the appropriate state information in your consumer loop for whether a user is logged in or not as well as the current state of the solenoid. You can disable the control to turn the solenoid on or off depending on whether the user is logged in or not.

If I get some time later I can try to put together a quick example of this architecture. In the meantime you can look at the examples for the producer/consumer architecture in the NI examples.

Unless I completely misunderstand your requirements I think you you mixing functionality (adding users, validating users, and controlling the solenoid) which will overly complicate the application.

Hi mark thanks for replying.Appreciate it!! By the way where can i find the NI examples.I not actually good at VI.I will ask my partner to look on to your reply.

Im a noob here if you dont mind.Thanks again and cheers!!:)

Link to comment

Hi mark thanks for replying.Appreciate it!! By the way where can i find the NI examples.I not actually good at VI.I will ask my partner to look on to your reply.

Im a noob here if you dont mind.Thanks again and cheers!!:)

Under the Help menu there is an option to "Find Examples". This will bring up a dialog window which will allow you to search through the examples that ship with LabVIEW. Additionally you can search the forum here for examples of the producer/consumer architecture.

  • Like 1
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.