Increment and decrement with a Boolean input

Hello Labview Experts (and life savers actually !!)
In my VI ,I have  a numerical controller (knob) feeding a numerical indicator ,in addition to a bolean input.
As an initial state the numerical indicator will contain a certain value (zero for example) and will only receive the variation in the knob input as long as the bolean input is true and then add it to this initial value.
what is the variation ? lets say that the knob was on 8 before i hit the boolean true ,the indicator's value is zero ,and then I hit the boolean true ,
Now ,when i move the knob from 8 to 18 (+10 variation) ,I want the indicator to receive +10 and add it to the zero ,now the result is 0+10=10.
Now the boolean is false ,I move the knob and nothing happens to the 10 in the indicator.
Now the boolean is true again ,let's to say the knob was on 4 at the time i hit the boolean true ,and I move it from 4 to 1 (-3 variation) ,the indicator's value now will be 10+ (-3) = 7
I hope I explained the idea in a clear way ,I would be very thankful if someone would help me with that.
P.S. I only attached the vi for illustrating the idea.
Thanks in advance
Solved!
Go to Solution.
Attachments:
main components.vi ‏7 KB

You only care about how much the knob changed.  Therefore, you need to subtract the old value and the new value to get how much the knob changed.  Then inside the case structure, add that difference to your value that belongs in the shift register.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Incremental_BD.png ‏7 KB

Similar Messages

  • Is Increment and Decrement Operators Atomic?

    Is there a need to synchronize increment and decrement operations, or they are atomic? If so, how about pre and post variations?

    raychen wrote:
    jverd wrote:
    Simple rule: If multiple threads are accessing a variable, all access to that variable must be synchronized. There are exceptions, but you'll seldom go wrong by following that rule.I don't synchronize data member accesses in simple setters and getters, as JVM guarantees my read and write are atomic at the memory level. Am I making bad assumptions?Yup, you are. For a couple of reasons.
    1. Reading and writing of non-volatile longs and doubles is not guaranteed atomic.
    2. It also does NOT guarantee that one thread will ever even see a value written by another thread, however, unless either a) the variable is volatile, in which case threads don't have local copies all reads and writes go against the main copy, or b) access is synchronized and therefore the writing thread's local copy is flushed to main memory upon exiting exiting the sync block and the reading thread gets its first read after entering the sync block from the main copy.
    Edited by: jverd on Jul 21, 2009 10:33 AM

  • Increment and decrement buttons on a ring control are greyed out

    Hello,
      The check box for showing the increment and decrement buttons on a ring control are greyed out. Does anyone know why? I have verified that the ring is a control as opposed to a indicator.
    Regards,
    Kaspar
    Regards,
    Kaspar

    "the controls are greyed out because they do not exist on the Menu ring control."
    Errr... yes, I believe that's exactly what I said in my last response.
    "This is different from what I saw in another part of this forum about using event structures on a Menu ring."
    Don't know what you could be referring to, as there is no event specific to the increment/decrement controls. All that they would do (if they existed) is to change the value of the control, and the applicable event would be the "Value changed" event. Where exactly did you read this?

  • The Increment and Decrement Operators (++ and - - )

    Hi all !
    Even if i do understand how ++ and -- operators works fine (as a pre-modifers and post-modifers) but i can't understand how do they got the HIGHTEST precedence (unary operators) over than other operators , consider the follwing examples :
    Ex(1):
    ======
    initially : x = 5 & y = 0;
    y = x++ ;
    i know the process goes like this :
    - Evaluation : Left-to-Right (y is 0 and x is 5)
    - Operation : assignement of x to y , then increment x by 1.
    Q(1) is : why do assignment first then increment even if operator ++ has higher precendence than "=" operator.
    (i understand that that is true if y=++x, but why? ).
    Ex(2):
    ======
    initially : x=5 & y =0;
    y = x++ + 5;
    y now is 10 , x now is 6
    Q(2) is : even if the ++ operator is higher in precedence ,the arithmetic operator "+" is evaluated first, why?
    (same applies to the -- operator)
    Thanks ...

    Q(1) is : why do assignment first then increment even
    if operator ++ has higher precendence than "="
    operator.
    (i understand that that is true if y=++x, but why? ).The assignment is not performed first:
    (1) Memory is reserved to store the result of the expression on the right hand side.
    (2) The expression evaluates to the current value of x, which is 5. This value is stored away.
    (3) x is incremented, and is now equal to 6.
    (4) The value previously stored away is assigned to y. y is now 5.
    Q(2) is : even if the ++ operator is higher in
    precedence ,the arithmetic operator "+" is evaluated
    first, why?The + operator is not evaluated first:
    (1) Memory is reserved to store the result of the expression on the right hand side.
    (2) The current value of x is stored in that reserved memory. The value is 5.
    (3) x is incremented to 6.
    (4) 5 is added to the expression result, and the result is now 10.
    (5) The expression result is assigned to y. y is now 10.
    Note that the implementation is free to perform the calculation however it wishes, so long as it is done such that the user/programmer can not tell the difference.

  • Numeric Format with "dB" causes strange Increment and Decrement behavior

    To reproduce this, drop a numeric control in LabVIEW (Version 8.2 and later).
    Right click on the numeric control and select properties
    Select the "Format and Precision" tab
    Select the "Advanced editing mode" radio button
    Change the Format string to "%#_gdB" and press OK.
    Type "-123" into the numeric control.
    Place the cursor inbetween the 2 and 3.  Press the up arrow.  The normal response of the numeric is to increment the number to the left of the cursor, in this case the 2.  The expected number is -113.  However, with the "dB" in the format string, the number becomes -11.3.  This caused a problem with a Signal Generator whose power output (in Decibels) was controlled by this instrument.  in 2 keystrokes, the power went from -80dB to 0dB and almost damaged some equipment.
    The work around is to remove the dB from the format string or put it in parenthesis.  However, this seems like a bug.  If someone from National Instruments determines this is a bug, please post the CAR# to this thread.  Otherwise, it would be nice to have this behavior explained.

    Interesting behavior. I confirmed this with 8.2. What's more interesting is that the behavior is not consistent. If you use "Hz" the control works as you expected it to work. If you use "A", and perform the same steps, pressing the up arrow gets you "NaN". I tried putting a space before the "dB", and it made no difference. At first I thought that the "d" was being misinterpreted, but the result from using "A" made no sense. Very odd.
    Lesson learned from your experience: Always make sure to check the values that you want to set before you actually set them. You should have 2 layers of checking. The lowest level checks the values against the instrument's capabilities. In other words, making sure you don't try to program a level of 100 when the instrument can only handle 10. A higher level should check values against usage limits. This is where you put in the valid ranges for how you're using the instrument. For example, even though the instrument may be able to go to 13 dBm, in your testing you may only want a maximum setting of, say, -20 dBm. In my code I write a wrapper VI around each driver function to implement this. This requires extra code, but it can save your butt in many instances.

  • Increment and decrement to reach upper and lower limit

    I have to simulate a central heating system. A heater is turned on, room temp rises to 'upper limit'; heater is turned off when upper limit is reached. When heater is off, temp drops until lower limit is reached then heater is turned on again. I'm scratching my head!! have tried various case structures but cant get it to run continually. Whats the best way to do this? PS, im a noob! :-)

    Use a shift register to keep the current heater state (since you only want the state to change when you go outside of the limits).  From there, the Select function helps keep things straight.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Heater control.png ‏12 KB

  • Titled pane auto size increment and decrement  in resizing pbm

    hi can anyone help me in fixing this issue ,
    i am getting the problem i need the titled pane to be occupying the whole space of window or the space of split pane size .. when there is a resize..

    The answer was a simple property setting - sweet!
    <s:VScrollBar id="verticalScrollBar" visible="false" 
                       fixedThumbSize="true"
                      skinClass="com.sprycel.views.controls.ThumbOnlyVScrollBarSkin"/>

  • Multiple booleans controlling one boolean input for a case structure

    Hello,
    I have four boolean buttons and a case structure with a boolean input. I would like to write the program so that whenever any one of the four boolean button changes value, the case structure reads true for one loop interation, and then returns to false.
    I have tried all sorts of things and can't seem to figure it out.
    Ultimately, the ideal function of the program is so that whenever you push any one of the four boolean voltage controllers, that voltage case is chosen in the case structure, the time in seconds is written to a file, and the elapsed time timer is reset.
    I have attached my program. Let me know if you have suggestions. Thanks.
    Attachments:
    Volt_Control_And_Time_Counter.vi ‏71 KB

    Zappow wrote:
    However, with this setup, the time counter still doesn't work.
    The event structure for all four buttons has a true boolean constant connected to my file-saving case structure. If I connect this to my elapsed time express VI reset button, the timer doesn't count.
    The timer does not count because you have not wired a timeout to the lower event structure. The default timeout is -1, so the lower loop never spins via timeout
    It is useless to have a wait in a loop that also has a timeout case. Just wire an approriate timeout value to the timeout terminal and remove all waits. It is also not necessary to have a 1ms ttimeout if your timeout values only displays to 100ms resolution. Can you explain why you think you need two loops and all that extra code?
    Attached is a quick rewrite that solves some of the problem. Since I don't have any hardware, I replace the voltage out with a meter.
    You have way too many FP controls and indicators. Use arrays!
    Let me know if yo have any questions. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Volt_Control_And_Time_CounterMOD.vi ‏63 KB

  • Custom action with XML type input and output parameter.

    Hi,
    I want to develop custom action with xml type input and/or output parameter.
    Is there sample code for java side. How is the definition of input and/or output parameter and set/get methods?
    does it need special .jar file to develop custom action like this?
    Thanks.

    Cemil - yes, you can use XML data types.  Use the class
    com.sap.lhcommon.xml.XMLDataType
    for your parameter type.  Here is a snippet from a custom action we use to log XML (instead of just returning the #text node like the default logger does):
    public class XMLLogger extends ActionReflectionBase
        private String source;
        private String eventType;
        private String textMessage;
        private XMLDataType xmlMessage;
        public XMLLogger()
            log = new Logger("UserLog");
            source = DEFAULT_SOURCE;
            eventType = TYPE_INFO;
            textMessage = "";
            xmlMessage = new XMLDataType();
        public XMLDataType getXmlMessage()
            return xmlMessage;
        public void setXmlMessage(XMLDataType xmlMessage)
            this.xmlMessage = xmlMessage;
        public void Invoke(Transaction transaction, ILog ilog)
            StringBuffer sb = new StringBuffer();
            sb.append('[');
            sb.append(source);
            sb.append("] ");
            sb.append(textMessage);
            sb.append(XMLUtils.convertXmlToString(xmlMessage));
    XMLUtils is a helper class we wrote - it's just a bunch of standard Java XML boilerplate code.  The important part you need to know is XMLDataType.getDocument() will return an org.w3c.dom.Document.
    I hope that was enough information to help.
    -tim

  • The plus(+) and minus(-) keys to increment or decrement the date

    Hi All,
    I have a date field in which I would like to have the + and - keys to increment or decrement the date as in some windows programs.
    Thank you, Bill

    Hi Chad, Yes I know the Date Picker... that is what it has now.
    My users are keyboard users... hitting the plus or minus sign in the Num Pad is much quicker if the date is only 2-3 day plus or minus...
    We desire to have the Date Picker and have maybe a onkey event call. I was hoping to find someone that has used "onkey" for a specific element/field so it doesn't look at every key stroke in the document but just the one date element onkeyup etc......
    Thanks for the response.
    Bill

  • I write digital port by 'DAQmx Configure Logging.vi​' and receive TDMS file with 8 boolean channels. How can I write to 1 integer channel?

    Hello!
    I want to write 1 digital port from PXI-6536 with streaming to TDMS file.
    I'm writing by 'DAQmx Configure Logging.vi' and become TDMS file with 8 boolean channels.
    How can I write to 1integer channel?
    Attachments:
    1.JPG ‏27 KB

    Hey Atrina,
    The actual data stored on disk is just the raw data (that is, a byte per sample in your case).  It's really just a matter of how that data is being represented in LabVIEW whenever you read back the TDMS file.
    I'm not sure if there is a better way to do this, but here is a way to accomplish what you're wanting:
    Read back the TDMS file as a digital waveform.  Then there's a conversion function in LabVIEW called DWDT Digital to Binary.  This function will convert that set of digital channels into the "port format" that you're wanting.  I've attached an example of what I mean.
    Note: When looking at this VI, there are a few things that the downgrade process did to the VI that I would not recommend for these TDMS files.  It added a 1.0 constant on the TDMS Open function, and it set "disable buffering" on the TDMS Open function to false; you can get rid of both of those constants.
    Message Edited by AndrewMc on 01-27-2010 11:21 AM
    Thanks,
    Andy McRorie
    NI R&D
    Attachments:
    digitalconvert.vi ‏13 KB

  • Hey guys ! I use logic pro ... not logic proX ... and i want to record my drums with 4 mics. I got a mixer with also 4 inputs ( Behringer Xenyx QX 1202USB ) But in my Logic i can't take the third input !?!? i can only choose 1 and 2 .... Please Help :)

    hey guys ! I use logic pro ... not logic proX ... and i want to record my drums with 4 mics. I got a mixer with also 4 inputs ( Behringer Xenyx QX 1202USB ) But in my Logic i can't take the third input !?!? i can only choose 1 and 2 .... Please Help

    Friedrich sp wrote:
    Can you send me a mixer wich can do that, please ?
    Who do you think I am? Santa Claus?
    What you need is not a mixer, but an audio interface with at least 4 mic inputs. There is a lot of choice there, but you should indicate a budget. You can go from, say, € 300 to € thousands, if you want.
    Roland UA 1010
    Focusrite Scarlett 18i8
    However, there are other options (like multi-out mixer plus multi in interface, or standalone mic preamps plus interface with 4 inputs, etc). I have little experience using these however so I really cannot say much about which one(s) to get. The two mentioned above both have four mic preamps, but they are by no means the only way to do it.
    The cheapest solution I can think of is to get a second 1204USB, plug it in, and in OS X create an Aggregate device (=the two are being merged into 'one virtual' interface with two discrete stereo (= four discrete mono) inputs. Disadvantage: you keep the same (limited) soundquality of the 16 bits convertors. Getting any of the interfaces mentioned earlier will also mean you'll make the significant step up from 16 to 24 bits sound.

  • Building a case structure with four boolean (true/false) inputs.

    I currently have two boolean inputs that I would like to use to select cases in a case structure. I would like to have four cases, each one dependent on the true/false condtions of the two booleans. If boolean 1 =true, then case 1 should be used, if boolean 2=true, then case 2 should be used, etc.
    What structure should I use to convert these boolean inputs into numeric cases?

    Or build them in to an array and "Search 1d Array".  If you are only looking for a single bool being true, this would be easier because your cases could be {0,1,2,3} instead of {1,2,4,8}

  • I need a sample vi that can plot a transfer function given zeroes and poles (It should allow the user to input zeroes and poles). It should be done in the S domain.The user should be allowed to put poles and zeroes, with frequency

    I need a sample vi that can plot a transfer function given zeroes and poles (It should allow the user to input zeroes and poles). The user should be allowed to put poles and zeroes, with frequency. DONE IN S DOMAIN.

    I have created a VI (LabVIEW 6.1) that does what you want. Note that the poles and zeros have to be entered correctly that is in Rad/s and typically with negative real part. The VI offers you all options for lin/log frequency axis, magnitude in dB or not, phase in Radians or Degrees etc...
    The VI is written with "academic" in mind, so it is not optimized for performances but (hopefully) for clarity. I hope this will work for you.
    Attachments:
    S-Domain_Transfer_Function_from_Poles-Zeros.vi ‏167 KB

  • I have to step-input an existing score and tried it with the step-input-window in combination with midi-input from an usb-keyboard.

    I have to step-input an existing score and tried it with the step-input-window in combination with midi-input from an usb-keyboard.

    Tsk tsk, Nigel, don't you see: this is a story - with a cliffhanger... he said he tried... but he never clarifies if he succeeded or not... but still, he has to do it. It's stronger than him, bigger than him, there's no escaping the step-input and midi-input via usb-keyboard scoring... it's fate I tell you! Fate!

Maybe you are looking for

  • [solved]dzen2 configuration issue

    I want split the groups + windows in the right side of the dzen bar and the time and "system tray" to the left. my first idea was to have two dzen2 processes running, one align to the right and one to the left, but looking through the wiki I found ^p

  • Sales and transfer posting

    we are into IS-RETAIL we have following requirement. Presently some of articles are lying in category 'A' .These articles are going to transfer to category 'B' with article to article transfer posting.   category A is asking us to register these unde

  • Startup Error in 10.3.9 - Apple appears then goies to Terminal

    Hi Folks Yesterday my hard drive was getting quite full, so I copied a load of work over to an External drive. Upon restart, the Apple Logo appears, then the screen goes black (looks similar to Terminal) and the message: -sh: /etc/profile: is a direc

  • DBIF_DSQL2_CONNECTERR - direct link to DB

    Hi all,         I'm working on a SAP system in which we want to access directly to our DB (DB4, MSS) by an ABAP program. In transaction DBCO we made the entries for the two DB  but when we try to execute the program the system returns the following e

  • Spanish Accented Characters creating problems - missing files, etc

    I am still working w/ iTunes 7.1.1.5 as I see no need to replace it for a different version. Throughout the history of this program I have noticed that it has trouble dealing with accent marks and characters that differ from that of the english alpha