LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help on creating dialog box to edit input variables

I'm a new LabVIEW user and am having difficulties in adding a dialog box to edit user-defined input variables. As shown in the block diagram of the attached VI there are two inputs (a, b) in the subvi that converts Required Velocity into Freqency and subsequently the hex code to pass on to the fan drive of the instrument. The relationship between velocity and frequency is linear and a default value for a and b has been defined as shown in the block diagram, but I would like to be able to create an "Edit" button at the front panel so that if the user desires he/she can click the button to bring up a dialog box to edit the values of a and b, so as to change the relationship for the particular experiment (as it might change with the ambient environment). I have tried to use Express -> Input -> Prompt User but nothing seems to work. Any help would be greatly appreciated!
Download All
0 Kudos
Message 1 of 8
(3,461 Views)
Hi "cryptic number",

what a load of locals... Seems you converted some C code into LabView...

I changed your vi just a little bit to use (much) less locals, frames and duplicate code. Some parts I still don't understand...

Please go along with this!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,451 Views)
Ahh, Gerd was a bit faster, but we both agree that your code is way too complicated and still stuck in the "C"ozoic era. You have tons of hidden indicators just for the sole purpose to serve as "variables" via locals. In LabVIEW, the wire is the variable.
 
 
To your question, I would keep a and b in a shift register and modify the content via the dialog box if needed. Attached is a small example.
 
Some advice (I rewrote the upper part of your code with them in mind. I left out the lower parts, but similar adive applies):
  1. It is sufficient to setup the serial port once at the start of the program, not with every iteration of the loop.
  2. None of your local variables are needed (except maybe one).
  3. None of your sequences are needed (except maybe one). (I show how to delay some code via data dependency)
  4. You don't need any hex formatted text anywhere. Make the diagram constants hex display and do everything in plain unformatted hex strings.
  5. I am not sure what kind of checksum you want, but you can probably find a subVI for it.
  6. Some of your code is plain silly. For example the use of "replace string subset" as a stand-in for "string subset"
  7. Your delay frame is on top of the other wires, thus it will run in parallel with all other stuff and will not delay anything. (see image).




Message Edited by altenbach on 04-20-2008 12:37 PM
Download All
0 Kudos
Message 3 of 8
(3,441 Views)
many thanks to GerdW and altenbach for the quick response. I've just tried to run both samples with the instrument, and a few issues came up.
 
GerdW:
Your sample seems to work, but any response to input (e.g. turning the change velocity switch to ON, changing the velocity value) seems to be delayed by about 7 minutes! Any ideas?
 
altenbach:
I'm having difficulties testing your sample because when I turn the change velocity switch to ON, regardless of what the initial values were on screen, the "out of velocity range" error message came up and would simply not close. Whenever I press cancel a new one comes up again, and I have no choice but to terminate LabVIEW to stop it.
0 Kudos
Message 4 of 8
(3,404 Views)
Hi cryptic number,

As I don't have any hardware attached to serial port your vi loops in seconds - I don't have any delays before changing velocity again... So I guess your hardware access is slow...

Ideas? Do as Altenbach says... Smiley Wink


Message Edited by GerdW on 04-21-2008 05:20 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(3,394 Views)


i53547916 wrote:
altenbach:
I'm having difficulties testing your sample because when I turn the change velocity switch to ON, regardless of what the initial values were on screen, the "out of velocity range" error message came up and would simply not close. Whenever I press cancel a new one comes up again, and I have no choice but to terminate LabVIEW to stop it.

Sorry, there is a small bug because I made a mistake. I canont test because I don't have your hardware so I am flying blind. 🙂
 
The dialog appears if the the value is "in range?" instead of "out of range?" as it is supposed to.
 
Simple solution: insert a "boolean NOT" in the wire leading to the dialog box part. Try it! (see image).
 
 
 
There are probably other bugs, but nothing some easy debugging can't fix. 😉
 
I am sure my code will be easier to debug than yours. 😄
 
Note that my code will also warn if the value is too low. If you don't want that, go back to your old boolean logic that only compares the upper value. See what's more suitable.

 


Message Edited by altenbach on 04-21-2008 08:31 AM
0 Kudos
Message 6 of 8
(3,389 Views)
adding "NOT" does seem to solve the problem of the error prompt, but the instrument would not start after Change Velocity has been switched on - admittedly I didn't wait for 7 minutes like I did last time! My C-like version (without the prompt) can start the instrument instantly though, so I'm rather puzzled as to why the two samples you two provided (which undoubtedly should be more efficient) takes so long. I have yet to figure out where the bottleneck/lag is in the code. Any ideas?
0 Kudos
Message 7 of 8
(3,372 Views)
latest working C-like version for reference. the edit conversion bit is just a dummy and doesn't work.
0 Kudos
Message 8 of 8
(3,370 Views)