LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from two serial ports simaltaneously with different baud rates

Hi,

I have two pressure manometers with RS-232 ports.
One of them is 2400 baud rate while the other is 9600 baud rate.
They continously spit out data on the port and there is no way to send commands to the two devices.
Since i have only one serial port, i am using a usb to serial adaptor for one of the devices.
I want to be able to read the two devices simaltaneously in a while loop, i come across the following error.

The instrument with the higher baud rate (9600) does not respond after the first read value and displays wrong information while the one with lower baud rate (2400) does respond correctly. If you change the pressure on the lower baud rate meter the higher baud rate meter begins to respond.

I suspect there is a problem with the timming ? Any ideas how i can solve this issue and get a clean stream of continous data ? I need this urgent.

Thanks
Gagan
0 Kudos
Message 1 of 18
(4,442 Views)
Hi,
Let me explain my understaning before answer.

One serial port giving data of two devices at different baud rates.

In this case you can read data using VISA functions in which it will buffer all data and give it to you. But you have to parse this data according to Device ID.

I feel this may help you. If you explain your problem in more details, I can help you to dig out solution.

Thanks.
0 Kudos
Message 2 of 18
(4,424 Views)
Can you post your code in the forum??
0 Kudos
Message 3 of 18
(4,421 Views)
Hi,

Its two serial ports, since the computer has only one physical RS232-port i am using the a USB to RS-232 for the second one. I will post the VI on monday since its at my computer at work. Any suggestions ?

Thanks
Gagan
0 Kudos
Message 4 of 18
(4,398 Views)
Hi,

Here is the attached VI for measuring Pressure from Two meters with different baud rates also there is a Stanford thermocouple from which i obtain the Temperature.

The problem is that i am unable to get a clean stream of data from the meter with the baud rate of 9600.


Gagan
0 Kudos
Message 5 of 18
(4,375 Views)
Both of your VISA Configure Serial Port functions are set to 2400 baud so if one is supposed to be 9600, you shouldn't be getting any data at all.
Message 6 of 18
(4,368 Views)
Sorry about that,

I had changed that, one of the VISA was setup to be 9600, i posted the older VI by mistake. The problem still exists
0 Kudos
Message 7 of 18
(4,363 Views)
One thing to try is to change the VISA Reads back to Asynchronous. Right click and select Do I/O Asynchronously. That's the default. There could be other issues that I'm not able to quickly see. What I would suggest is that you make a small VI with just a single loop and the two serial reads. Test that and see if you have any issues.

Message Edited by Dennis Knutson on 06-13-2005 09:09 AM

Message 8 of 18
(4,360 Views)
Another thing to consider: You are specifying the number of bytes to read. If the device has not sent that number for some reason, the read will wait. It is usually better to use the Bytes at Serial Port property node and then read the number of bytes actually available.

You might also look at the state machine architecture for your program.

Lynn
Message 9 of 18
(4,345 Views)
How do you use this property node ? Where can i find it and could you please explain what you mean by
"state machine architecture for your program".

Thanks
0 Kudos
Message 10 of 18
(4,336 Views)