LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port queries

1. I have attached a serial VI.

2. Usually I have to select com port & then start the VI. But how to do that: first I start VI & then VI ask sends a pop message to select comport & then run?

3. Serial VISA has timeout attached with it. But suppose my system is connected continuously for days. and user can send data from outside to VI at any given point. How to dela with it?

4. Every time I rerun the VI it takes last values of control and indicator. How to do that every time I start VI, control/indicator set to some predefined values

0 Kudos
Message 1 of 7
(3,834 Views)

Please stick with your original thread!

Don't create duplicate threads!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(3,826 Views)

Ho thats not duplicate thread.

Both have different queries, subject lines may look similiar. 

0 Kudos
Message 3 of 7
(3,819 Views)

You didn't attach a VI and you still talk about serial port problems…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(3,814 Views)

@Vindhyachal.Takniki wrote:

1. I have attached a serial VI.

2. Usually I have to select com port & then start the VI. But how to do that: first I start VI & then VI ask sends a pop message to select comport & then run?

3. Serial VISA has timeout attached with it. But suppose my system is connected continuously for days. and user can send data from outside to VI at any given point. How to dela with it?

4. Every time I rerun the VI it takes last values of control and indicator. How to do that every time I start VI, control/indicator set to some predefined values


1. No you didn't

2. Adding a dialog box is an option.  Just make its output for the selected port go into the Configure Serial Port.  Another option is to read the port to use from a configuration file or text file.

3. You could just let the timeout happen and ignore any of the data when you do have a timeout.  If you do not know when your data will come in, I use the Bytes At Port node to see if there is any data in the port.  If there is data, read your entire message.  If there is no data, throw in a wait (something like 50ms is usually a good amount).

4. There is a VI method called Default Values.Reinitialize All To Default


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(3,803 Views)

1. Sry I didn't attached the VI.

 

2. I have created a dialog box as in attached dialog.vi. But when I create input in dialog box, it has option of numeric/checkbox only. So datatype of both configure serial port input donot match as error is in vi.

 

3. I have created a function byte at node as in attached serial.vi. But it still has visa configure function & its timeout?

 

4. For initialize control to default, I have done is in attached default.vi:

Right click Numeric2->Data operation->make current value default

RIght click Numeric2->create->invoke node->reinit to default

 

Now a object appeared in block diagram as shown in VI. It has error in & out. 

What to do now. Do I leave it unconnected??

 

But after placing this in VI, control always init to default whenevr re-run.

 

 

Download All
0 Kudos
Message 6 of 7
(3,762 Views)

Vindhyachal.Takniki wrote: 

3. I have created a function byte at node as in attached serial.vi. But it still has visa configure function & its timeout?


But you didn't do anything with it.  The idea here is to do a comparison with the number of bytes in the port.  If there are more than 0 bytes, then do your read.  If there are 0 bytes at the port, you wait something like 50ms.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 7
(3,732 Views)