Jump to content

clearing indicators and sending control values


Recommended Posts

Hi,

I am using event structures entirely to my program and don't know how to clear my indicators when ever i need. More i want to create a send button to control which are in event structure and when ever user enter some data in it and one clicked send button should start event case and ron the particular control which are entered by user.

You can also see the picture downside and attcjed VI. Hope you all undestand my problem and looking for help. Some suggest me. I am very new to labview.

the white back ground represents all controls and up you can see some indicators.

post-20037-0-26302400-1300715907_thumb.p

rajnew.vi

Edited by sjukheter
Link to comment

You're trying to reset your indicators with your controls? I'm not completely following what it is you're trying to do. I attached your VI with a few edits just to make a few pointers.

• One thing you can do to get rid of repeated local variables in your event cases is to put shift registers on your while loop and run the wires through your event at the top of the loop. Then the data in the shift register is available to all your cases and you don't have to create a bunch of locals.

• You're using the timeout event with a zero wired to the input. This will continually run the code within it as quickly as possible. You'll find the timeout event in event structures is rarely used. If you want some kind of continuous operation, consider adding a second while loop without an event structure in it.

• You can optionally add your controls/indicators to a cluster and save it as a typedef to make it easy to edit and reuse other places in your code. Notice in the events where you are updating indicators, I've instead used the bundle by name function to update specific indicators within the cluster.

• I'm not sure why the numeric controls are used as visa commands that are then being written back to their own locals with the output from visa read, but maybe I'm not understanding something about how your program is supposed to function.

Try to elaborate on what it is you're tyring to do and I'll see if I can help.

Eric

rajnew-edit1.zip

Link to comment

You're trying to reset your indicators with your controls? I'm not completely following what it is you're trying to do. I attached your VI with a few edits just to make a few pointers.

• One thing you can do to get rid of repeated local variables in your event cases is to put shift registers on your while loop and run the wires through your event at the top of the loop. Then the data in the shift register is available to all your cases and you don't have to create a bunch of locals.

• You're using the timeout event with a zero wired to the input. This will continually run the code within it as quickly as possible. You'll find the timeout event in event structures is rarely used. If you want some kind of continuous operation, consider adding a second while loop without an event structure in it.

• You can optionally add your controls/indicators to a cluster and save it as a typedef to make it easy to edit and reuse other places in your code. Notice in the events where you are updating indicators, I've instead used the bundle by name function to update specific indicators within the cluster.

• I'm not sure why the numeric controls are used as visa commands that are then being written back to their own locals with the output from visa read, but maybe I'm not understanding something about how your program is supposed to function.

Try to elaborate on what it is you're tyring to do and I'll see if I can help.

Eric

As i am new to labview and understanding your points straight away is difficult forme. Though, I will try when you post the given example in labview8.5 version.

I am just making GUI to control the SMPS. In part of that I created address search function in timeout case to run continously in the case of no user event. Also, coming to local variables, i don't know how to use shift register for reducing local variables. thank you for your suggestions and need to see the given example. Please post it in 2008 version.

In my program, I am using 8 indicators for display the read vale -----for these all indicators i would like to create one CLEAR buuton to erase all the indicators to zero between the programm running.

controls for wiring the data inti serial device-----I have taken one case per control and i would like to create SEND button for these all controls. If user enter any value in nay of the control and then clicked SEND button will write these values into device. Now, value change event will write all the values into device if user try to enter new value in any control but i would like do the above way with send button. Now i think you got my point to build this.

Please give me any suggestions.

I am planning to learn statemachines with any examples before and some assignements followed. Can you help me with any link.

Link to comment

I saved the edited version in 8.5 and attached.

A queued state machine could work for what you're doing, but might be more than you want to look into right now.

If you're really going to use the timeout event like that, at least wire a number other than zero to it. That prevents it from eating up as much CPU by limiting how often it executes. Keep in mind that making your application work this way is something you should consider changing in the future as it's not considered best practice.

I added a clear button and a corresponding event case that writes zeros to all your indicators.

After a loop executes data is written to the shift register on the right side of a loop then that data becomes available on the next loop iteration on the left side of the loop. Spend a little bit of time learning about shift registers. I attached an example to show you what happens with shift registers. Watch numeric2 and see how it contains data from the previous loop iteration.

State machine description

http://zone.ni.com/devzone/cda/tut/p/id/3024

If you want to see some state machines implemented in examples, the CLD sample exams are a good resource for that.

https://lumen.ni.com/nicif/us/ekitcldexmprp/content.xhtml

rajnew-edit1 8.5.zip

shift register example.vi

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.