LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case and events lag

Hi,

 

First post and new to LabVIEW be nice.

Ok the issue is this. I have three drop down combo boxes Setting, Fix and COORD (cast to Int 16 for Test stand loops) that select x-y coordinates. The x coordinate is then added to one of 5 possible offsets represented by another int 16 combo box. What I am trying to get to work is the offset is added to the x Coordinate whenever one of the three (Setting, Fix and COORD) combo boxes are selected. I have enclosed 2 vi`s that change the X-Y but need 2 drop down selections before the "offset" is taken into account. What i need is: -

  1. the Program to update the X-Y with the offset whenever the "value change" occurs and to remember the offset and add to  the new x coordinate
  2. Ideally change the X_Y when all four boxes change. 
Download All
0 Kudos
Message 1 of 9
(3,885 Views)

can you explain your requirment in steps?

Your requirmrnt seems to be simple but i am not getting clear picture on what to do exactly/

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 9
(3,876 Views)

Thanks for the quick reply.

The requirments I am testing with this code are: -

  1. The system displays 3 formats (Coord, Settting and fix) with 5 keys on each format (names not important).
  2. Each set of formats can be in 5 different places (offset) - think muliple monitors.
  3. The code need to returns the X-Y on the display surface. The X-Y vaules are calulated from the key and format selected (fixed X-Y supply through an .INI file) + the user selected "offset"  (for automatic key selection or just to test its postion).

So i need a system that allows me to select one of 5 keys from 3 formats (i did this with a drop down) and add the offset (selected monitor) regardless of the key selected.

 

I have suppled a rough outline drawing.

 

 

0 Kudos
Message 3 of 9
(3,857 Views)

For each value change in "fix and setting" Enum do you want same calculation or based on selection the value needs to be changed?

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 9
(3,847 Views)

Hi,

 

the output X-Y will change dependant on the Coord, Setting and fix key selected 

0 Kudos
Message 5 of 9
(3,826 Views)

First of all, an event structure is pretty useless unless it is surrounded by a while loop, because it can only process one event per run.

 

Please explain once more how the VI should be operated and what you expect as result.

 

0 Kudos
Message 6 of 9
(3,811 Views)

@altenbach wrote:

First of all, an event structure is pretty useless unless it is surrounded by a while loop, because it can only process one event per run.

 

Please explain once more how the VI should be operated and what you expect as result.

 


I guess he was using the VI in "Run Continuously" mode...

 

edit: honestly I just do not understand why people chose the hard way to "learn" LV...it would take a couple of days to go through Core 1, and another 2-3 to go through Core 2. But lets double it. After going through the online courses, it would be much much faster the learning curve. We see in the forum like every day Event structures without a while loop (and other basic mistakes), so I guess people just do not want to go the easy way...

 

Edit2: for the OP, here you can find options to learn LV (under the title : "looking for free training"): https://decibel.ni.com/content/docs/DOC-40451

0 Kudos
Message 7 of 9
(3,804 Views)

I have added a while loop and simplified the code see attached (Note; this code is a cut down sample of what we are doing).

 

When the event is triggered (I have removed the maths part here which works ) I would expect the code "add function" to add the value from the case statment (0, 1, 2, 3 or 4) to the value from the event (10) dependant on the Case Enum selected. This is the case but you have to trigger the event twice before x becomes the correct value once the selected enum changes.  

0 Kudos
Message 8 of 9
(3,770 Views)

You should really go through the tutorials, you do not understand data flow. This VI does have multiple problems. The stop button should be in an Event case. You should have the functions (like the Add) inside the Event structure. You should not have that CASE structure at all, the OFFSET control gives you the same values as your CASE structure. You should have that functionality (OFFSET) inside the Event Structure. I do not understand why you have that "Coord" control? You do not use its value (yet)?

 

You need to learn about Shift Registers (so any Event case/state machine state can access your values), Type Definitions, then State Machines! I just modified your VI a little bit to give you some idea about data flow and shift registers, but the final application SHOULD be a proper State Machine in a project, not only as this example below (also having a typedef cluster holding/bundling the required data to minimize number of wires). I deleted that not used "Coord" control also, since you do not use its value!

 

edit: If you want to understand data flow better, you could run this VI, and visually see how data is "flowing" in the wires, and how the Event structure reacts for your click. You just need to turn on the "Highlight Execution" option, the light bulb icon at top of the BD window...

 

edit2: I hope you understand I just try to help. Beleive me, if you take the tutorials FIRST, then AFTER try to put together your project, the whole work will just go much better for you!

 

Event and case_3.png

 

 

 

 

 

 

0 Kudos
Message 9 of 9
(3,761 Views)