LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Local variable exercise problem

Look and run vt92's example. Your's will not work because you are constantly writing to the locals. His will because the of the event structure and the left and right are only changed when the master changes. I don't know what other help you need since you've gotten a way that works. You just have to replace the property nodes with locals and set the left and right to match the master instead of adding to the current value.

0 Kudos
Message 11 of 21
(1,220 Views)
what do you mean by "match the master". This is all become irritating because I think you did'nt read my first post. As I've mentioned in that I am doing it as an exercise and I've to do it using shift registers. I am attaching the edited vi and i've replaced the property nodes with locals please edit it for me. It will be great if it will be without event structure and with shift register and while loop. I've got your point but as i've mentioned i am doing it as an exercise so i have to do it in this way. Hope you don't mind for such a silly attitude.
Message Edited by Naqqash_IIEE on 03-19-2009 02:52 PM
Naqqash
0 Kudos
Message 12 of 21
(1,212 Views)
Your first post (or your second) does not mention shift registers. Maybe if you posted the actual homework assignment because I for one, am having a hard time trying to understand what values you are supposed to be passing through the shift register. If you do not want to use an event structure, then you will also need to do quite a bit more coding.
0 Kudos
Message 13 of 21
(1,203 Views)

Actually im using a book " Labview for Everyone...." by Jeffery Travis and Jim Kring. This is one of the activity in it, which I've to do accordingly. Here is the actual lines from the book.(its my bad that i've lost the CD somewher which include the solution)

 

.......In many applications, you may want some type of "master" control that modifies the values on other controls. Suppose you wanted a simple panel to control your home stereo volumes. The computer presumably is connected to the stereo volume control in some way. In the VI shown next, a simulated sound control panel has three slide controls: left channel, right channel, and master. The left and right channel can be set independently; moving the master slide needs to increment or decrement the left and right volumes proportionally.

Build the block diagram for the front panel shown in Figure 13.15. The fun part about this is that by moving the master slide, you should be able to watch the other two slides move in response.......    You will need to use shift registers for this exercise.

Figure is actually the block diagram of my posted VI.

Naqqash
0 Kudos
Message 14 of 21
(1,194 Views)
The link to Figure 13.15 does not work for me
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 15 of 21
(1,188 Views)
Its actually the FRONT PANEL of My previously posted "local var.vi".
Naqqash
0 Kudos
Message 16 of 21
(1,179 Views)
I understand a little more now. The left and right would have to decrease in response to a decrease in the master and is not just a simple addition. I'll try to provide an example in a while.
0 Kudos
Message 17 of 21
(1,176 Views)

Some tips:

1... Nobody will do your homework for you. 

2...  If you can't use an event structure, you will have to use a "change-detector" which is how we did it before Events came along.  A change detector puts the current value of a control into the right-side shift reg every time thru the loop.  It also compares the new value with the old value (from the left-side shift reg.).  If they're the same, you do nothing (except wait).  If they're different, you react to the change.

3... You don't want to write continuously to a local variable - that leaves it unable to respond to user clicks/dragging/whatever.  You want to write to a local only when you need to - i.e., only when something has changed.

4... That means your general philosophy has to be:

 

  • If LEFT has changed, adjust left volume.
  • If RIGHT has changed, adjust right volume.
  • If MASTER has changed, adjust both the LEFT and RIGHT according to the proportion of MATER change,
  • if QUIT button changed, quit
  • else wait and loop

 

 

HTH 

   

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 18 of 21
(1,169 Views)

Dennis Knutson wrote:
Your first post (or your second) does not mention shift registers.

Even the title says: "Local variable exercise problem" 😉

 

I'm one of those who believe that most people should not code using Locals simply because they will abuse them and cause more problem with the code than expected..

 

I think everyone is asking for you to describe how you want to tackle this, which may mean to step away from the exercise so that you can learn about better approaches to resolve this.  In other words, how do you see the software doing this task of adjusting the volume based on different controls.

 

R

Message Edited by Ray.R on 03-19-2009 05:56 PM
Message 19 of 21
(1,145 Views)

Here's the solution

0 Kudos
Message 20 of 21
(869 Views)