LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read data from serialport while Wait for events in event structure ?

 
HFZ
Download All
0 Kudos
Message 11 of 20
(1,599 Views)
 
HFZ
Download All
0 Kudos
Message 12 of 20
(1,593 Views)
NEWEXAMPLE.VI i sthe main vi, all other are the sub vi's, then the global.vi
HFZ
HFZ
0 Kudos
Message 13 of 20
(1,592 Views)

Hi HFZ,

I do not have LV installed at my PC at the moment.  I will look at your vi's as soon as I can.

"i cant control a while loop by a  start/stop switch as Global variable!"

You have to be careful when using Global Variables...  I will need to see how you implemented it.   It should be easy to solve.

Ray

🙂

Message 14 of 20
(1,583 Views)
Hi Ray
Here  you got a jpg picture
its about the main ´.vi.
Ifigured out how to send the data , but i got that problem now that when i swith the start/stop switch to stop it stops the eventcase like wished but i cant get the small case structure to stop. then  when i switch again to start i cant get the event case running (ready ) again , what do u suppose??
 
thanks for help.
waiting!
HFZ
0 Kudos
Message 15 of 20
(1,585 Views)

Hi HFZ,

 

It is interesting how you are using Globals as controls.  I would recommend not using them for this. 

 

Let’s start with the Start/Stop switch.  Yes, it will control the Case Structure, but that’s about it. 

Please explain how you wish to control the outer loop and why you are using a Global.  You can force no action by sharing the stop logic with other Case Statements, but we’ll talk about better approaches later, for now, I would clean up the globals.    Unless it is used somewhere outside the jpg picture, I would remove the Start/Stop global.  If you want the outer loop to stop upon selecting Stop, the wire the switch directly to the Loop Control (remove the T/F selector) and set the while loop control to “Run If True” (right click on it to change selection.  This is if the switch is True in the Start position, otherwise reverse the logic at the loop control.

 

5000 char limit, so this is part 1

Message 16 of 20
(1,560 Views)

here is part 2  (they need to extend the 5000 char limit 😉  )

 

You may want to pay attention to the data flow between the Data Read and the rest of the vi’s components… we’ll cover that later as well.  But basically, you can control the flow of data (or events) by cleverly routing the Error Cluster wire

 

You can move the VISA Resource Name 2 closer to VISA Write, unless it is being used by other vi’s.  I try to keep items closer. 

 

Try to remove the following samplerate global by wiring it directly to the Num to String vi

Also wire the two Boolean controls “Data” and “flow” directly to the selector.

 

I suspect that the vi is not yet finished, because you have a Case Statement with a [C] which goes nowhere.  Same with the VISA Resource Name 3.

 

Now I see your problem.  You are trying to stop the inner loop by looking for an empty string after the subset of a carriage return.  Actually, this will not work unless you terminate your string with a carriage return, at the moment, it ends with pw=a    go, so you’ll never get a matching situation with an empty string.  Define what should stop the inner loop.

 

This is a start.  Hope it helps.

 

Ray

J
:
Message 17 of 20
(1,559 Views)

That is strange...  Below only has 1961 characters... so why do I keep getting exceed max char 5000 limit???

Anyway, here is another try to post my original message: (sorry)

 

Hi HFZ,

It is interesting how you are using Globals as controls.  I would recommend not using them for this. 

Let’s start with the Start/Stop switch.  Yes, it will control the Case Structure, but that’s about it. 
Please explain how you wish to control the outer loop and why you are using a Global.  You can force no action by sharing the stop logic with other Case Statements, but we’ll talk about better approaches later, for now, I would clean up the globals.    Unless it is used somewhere outside the jpg picture, I would remove the Start/Stop global.  If you want the outer loop to stop upon selecting Stop, the wire the switch directly to the Loop Control (remove the T/F selector) and set the while loop control to “Run If True” (right click on it to change selection.  This is if the switch is True in the Start position, otherwise reverse the logic at the loop control.

You may want to pay attention to the data flow between the Data Read and the rest of the vi’s components… we’ll cover that later as well.  But basically, you can control the flow of data (or events) by cleverly routing the Error Cluster wire

You can move the VISA Resource Name 2 closer to VISA Write, unless it is being used by other vi’s.  I try to keep items closer. 

Try to remove the following samplerate global by wiring it directly to the Num to String vi
Also wire the two Boolean controls “Data” and “flow” directly to the selector.

I suspect that the vi is not yet finished, because you have a Case Statement with a [C] which goes nowhere.  Same with the VISA Resource Name 3.

Now I see your problem.  You are trying to stop the inner loop by looking for an empty string after the subset of a carriage return.  Actually, this will not work unless you terminate your string with a carriage return, at the moment, it ends with pw=a    go, so you’ll never get a matching situation with an empty string.  Define what should stop the inner loop.

This is a start.  Hope it helps.

Ray

Message 18 of 20
(1,559 Views)
Hi ray,
I have done it, I maked it work with minimal problems,
But it seems that you didn't get it all about what the program in hole are doing.
I need the globals but not all of them, I need them coz, these changes that are made by the buttons, must beused in a sub.vi,.
.next, when u got the labview program installed at your PC, then send me a message by replaying in here, So i can send you the the new vers. of my program,... now I got others small problems. So i  hope you are there for me...
By the way  Thank you very much for your interest for helping me.
i'm still working with my program....
Zamzam 
HFZ
0 Kudos
Message 19 of 20
(1,549 Views)

Hi HFZ,

You are welcomed and you can post your vi.

Ray

😄

Message 20 of 20
(1,543 Views)