LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple logical problem

Dear all,
 
Am new to Labview. Am facing a small logical problem in developing my application. I can't able to release the knot. Please suggest asap.
 
I used two buttons for switching actions. Previously one switch and other latch but since latch is incompatible with local and global variables i configured that too as a button now. am using LabVIEW 8.5
 
From my another testing application (USBCV utility), When a window popup (say connect), i have to push one button down and when a window popup (say disconnect) i have to pull up the same button. When another window (say wakeup) popup i have to use the other switch button.
 
The windows popup in this order: 1) Connect 2) Wakeup 3) Wakeup 4) Disconnect 5) Connect 6) Disconnect 7) Connect 😎 Disconnect......
 
When the particular window popups, the corresponding switches will have to do that press/depress actions automatically.
 
As of now i used that two switches inside parallel port read and write.vi (Example Finder) and control the necessary actions by manually pressing switches when the windows popups.
 
Now i want the things to done autmatically (switch press/depress) in the order the windows popups from the USBCV application.
 
Please give me a sample structure for my program to proceed.
 
Thanks & Kind Regards,
Mathan
Message 1 of 16
(3,621 Views)

Hi Mathan,

You ll have to use the local variables to write the desired data to the other button when one button is pressed, thats it.

Maybe, you ve to take a little care so that the buttons do not race each other.

- Partha ( CLD until Oct 2027 🙂 )
Message 2 of 16
(3,619 Views)

/////Hi Mathan,

/////You ll have to use the local variables to write the desired data to the other button when one button is pressed, thats it.

/////Maybe, you ve to take a little care so that the buttons do not race each other.

Dear partha,

You mean you ask me to create another two buttons and using its locals for controlling the actions of original two buttons? Please explain little bit.

Also, if i use a flat sequence structure for setting the switch controls, then corresponding switch actions not happening outside the structure. Please give me a sample structure for implementing this.

Thanks in advance,

Mathan

Message 3 of 16
(3,614 Views)

Not two more buttons to control the original two buttons. But only using the locals of those 2 original buttons only.

I dont have time left today for making the example. Ill post tomorrow.

- Partha ( CLD until Oct 2027 🙂 )
Message 4 of 16
(3,608 Views)
Another solution is to use an event driven structure with user events that actually do all the actual work. That way all the buttons that want mechanical actions. To find about about this a bunch of other stuff that will make your life easier, get signed up for LV Basics I and II classes. They will be worth far more than what they cost.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 16
(3,572 Views)


mathan wrote:
From my another testing application (USBCV utility), When a window popup (say connect), i have to push one button down and when a window popup (say disconnect) i have to pull up the same button. When another window (say wakeup) popup i have to use the other switch button.
 
The windows popup in this order: 1) Connect 2) Wakeup 3) Wakeup 4) Disconnect 5) Connect 6) Disconnect 7) Connect 😎 Disconnect......
 
When the particular window popups, the corresponding switches will have to do that press/depress actions automatically.
Hi Mathan,
 
It seems thatyou 2 buttons are NOT present in the Main UI, but one each inside the 2 SubVI pop-ups... am I right... ?!
 
If so, how you have configured the SubVIs' VI Properties? I mean the Window properties, whether Modal/Floating...
 
Is it that both the SubVIs can be popped up from the MainVI parallelly or you can invoke only one popup at a time?
 
If it is the former case, you can use the Reference to the booleans to be passed inside the respective SubVIs to make them switch states automatically.
 
If it is the latter case. I m not so sure of a correct method to achieve things you want to.
 
Maybe, can you post the code/portion of it that you have developed till now?
- Partha ( CLD until Oct 2027 🙂 )
Message 6 of 16
(3,566 Views)
Hai Partha,
 
First of all thanks. I am sorry i didn't explained clearly in my previous post i think.
 
Well. Here am explaining bit more detail.
 
Actually the attached backbone.vi will be helpful in controlling the parallel port. For that i have used global.vi where 2 switches Connect/Disconnect and Remote buttons will be there. If i press Connect/Disconnect button once(Switch when pressed), it will enable the 2nd pin and again press means disable 2nd pin. The LED at the second place in data read register will help in knowing the status.
 
The second switch Remote(Actually better if it was configured as Latch when released but due to latch incompatibility with global variables i reconfigured it as - Switch when released) controls control register C3. The Remote switch when pressed (that is when the C3 will get high value it will generate a mouse right click - it was developed by some hardwares using FET's and some small electronics circuits).
 
All these portions i developed last week. Now i will explain what i originally requires....
 
Actually the main aim of project is to test a USB device connected to the system. For that testing, a utility namely USBCV was there. It will do all the tests for the device. The thing is during the tests some small windows will popup saying connect the device or disconnect the device or it will say please initiate wakeup. Like that windows will popup for each and every test sequentially. Exactly 12 tests are there and the windows will popup in this order.
1) Connect 2) Wakeup 3) Wakeup 4) Disconnect 5) Connect 6) Disconnect 7) Connect 😎 Disconnect......12)Disconnect.
 
For these things its impossible for a man to sit and connect or disconnect the device when the test runs for say some 100 iterations. So everything needs to be automated. Hence i used some hardware setup and backbone.vi and global.vi and cross-checked manually giving inputs. When i launched the USBCV utility and run this vi and whenever the window popups asking connect or disconnect or wakeup, when i press the corresponding switch, the test undergoes very fine. No problem.
 
Now am coming to the actual problem. For automating the test, whenever the utility generates a window popup, my vi should automatically press the corresponding switch.
 
What i tried first time is - since i know the exact order of the window popup, i moved the mouse pointer(user32.dll - setcurtsorpos) to the corresponding switch and generate a click action automatically(user32.dll - mouse_event). But its not an effiicient way of programming and i gave up that idea even before developing it.
 
I think i have explained some what understandable. I have attached the vi's also. Please help me in proceeding further. If possible give me a sample structure as early as possible. waiting for a favorite response.
 
Thanks & Regards,
Mathan
Download All
Message 7 of 16
(3,556 Views)

Hi Mathan,

I ve made your requirement using a simple Enum-Case driven State Machine model of programming architecture.

See the VIs & tell me if they roughly fit as your requirement. Modify as needed.

- Partha ( CLD until Oct 2027 🙂 )
Download All
Message 8 of 16
(3,538 Views)
Hai partha,
 
Thanks for replying very fast. Am trying with that. I will get back in another half an hour.
 
In the USB Auto Status Check.vi i saw the subvi named 6 (wakeup.vi) has a input at the top left corner to which you have given a boolean constant. How to bring that input to that subvi.
 
Thanks,
Mathan
Message 9 of 16
(3,527 Views)

Hi Mathan,

It seems that you re very new to LabVIEW. An Input/Output can be passed to/from a SubVI by using the Connector Pane lying on the top-right corner of a VI. It can be accessed only from the Front Panel of a VI.

For that matter, any VI can be termed as a SubVI if it is sitting inside any other VI or called dynamically using the VI Server method.

You rt-click the Connector Pane & tell Show Connector so that LV displays a default Pattern of the Connector Pane.

Now, click on the Boolean on the FP & click on any box of the Connector Pane using the wiring tool to male a connection. You can see the box inherit the colour of the type of the control you have wired.

Normally, make it a practice to connect inputs on the left-half of the pane & outputs on the right-half of the pane.

After placing this SubVI inside the MainVI, just rt-click on the connected terminal & choose Create Constant from the short-cut menu to create that Boolean constant on the BD.

IMO, you have to study some basic tutorials of LV to get used to all these stuff.

- Partha ( CLD until Oct 2027 🙂 )
Message 10 of 16
(3,517 Views)