LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from serial port

Hello;

Along to this question; I used Visa Configure Serial Port, I need two of them. Is there any way to have two of this for two different port numbers?

When I add another one, changeing in any of them make changes to another one too. For example when I change Buad rate for one of t hem to 38400 another one also auomatically changed too!

 

Thanks

0 Kudos
Message 11 of 36
(3,515 Views)

You can use two of them.  It only affects the whichever port you defined on the purple VISA wire going in.  So , for example Com 1,  if you need a baud rate of 38400, wire upt that constant to the Configure port VI.  For your com2 if you need 9600, it is a different purple wire going into that copy of the subVI, wire a constant of 9600.

0 Kudos
Message 12 of 36
(3,503 Views)

Thanks for your respond.

I created it. I don't have my device ready to test it. But seems it works good, at least for one of my port which is ready and another is blank.

If I face to further problem, ask again:).

 

Thanks;

Sb

0 Kudos
Message 13 of 36
(3,497 Views)

Things to think of regarding RS232 that i've bummed out on several times:

Remember to open and close the Visa port

Use a port that exists (doh) (especially if using usb->serial where the com port might change)

Set the communication parameters correctly before communicating

 

Standard simple things that can cause hours of debugging.

 

Else it's a string read from port that you need to handle appropriatly, no different from reading from a file.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 14 of 36
(3,480 Views)

Actually; The front panel shows me different port number (imagine that I use the same baud rate from different ports).

When I double click on the VIsa Serial in block diagram I see the same info for both of them, both the same port number.

I set up my devices, and just one of the port works, another one has problem.

0 Kudos
Message 15 of 36
(3,457 Views)

You are wiring the same baud rate control into both Serial Init VI's.

 

If you want them to be different baud rates, you have to wire different numbers into them.

 

It doesn't matter what the subVI shows when you double click on it, that only matters if you don't have a value wired into the connector pane.

 

And for the values of the VISA controls, you do have two separate controls, but their default values are the same Com1 port.  Are you changing one of them before you run your VI?

 

 

0 Kudos
Message 16 of 36
(3,448 Views)

I want to have the same baud rate. BUt reading from different COm port. On the front control, I did change the COMp port. I set one for COM 1 another COM 4.

 

But when it starts receiving data, one of them become red (means error).

DO you think any wrong on this diagram?

 

Thanks

0 Kudos
Message 17 of 36
(3,440 Views)

Okay.  I thought you wanted to different baud rates based on what you said back in message #11.

 

If you get an error, what does it say?  Do you have an error number?

0 Kudos
Message 18 of 36
(3,432 Views)

I am in Highlighted Execution (The Lamp).

I see that one of the port doesn't send the data. I just receive the time (Not coming from the COM port)!

Thanks for your help.

0 Kudos
Message 19 of 36
(3,418 Views)

So, you have no error indicator - bad design. If you had, you could right click on it to get an explanation. You can also go to Help>Explain Error.

 

The error is VISA:  (Hex 0xBFFF0072) The resource is valid, but VISA cannot currently access it.

 

Do you have another program using that port?

0 Kudos
Message 20 of 36
(3,400 Views)