Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How do get several inputs through RS232

I´m trying to program a PID control in Labview. It looks very much like the example that is avileble. However, I´m using serial RS232 comunication and I need to get 2 inputs instead of one. Labview is very new to me and I dont have a clue how to solve this. How do I get several inputs through RS232?. How should my blockdiagram look like?. Does anyone have a similar example to share. I would be very greatful for any help I can get.
0 Kudos
Message 1 of 10
(5,352 Views)
If you could post an example of the data stream you are recieving, we could help you parse it for the fields you are after.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 10
(5,352 Views)
I have 2 analog sensors conected to a A/D-converter(home made). I want to use one signal to the PID and the other as a trigger signal (means that the first signal will be ignored if the other isn´t big enough).
I cant figure out how to get the two signals simultanous into the computer using serial drivers.
0 Kudos
Message 3 of 10
(5,352 Views)
RS-232 is only designed for 1 instrument. See Appendix B of the Serial User Manual
Ray K
NI Applications Engineer
0 Kudos
Message 4 of 10
(5,352 Views)
sounds like you have one home made device that talks over RS-232 to the PC.

Hanging off of that home-made device are two sensors.

If this is right so far, proceed.

What is the format of the data that comes back from the home-made device?

Tell us that and we will be half way there.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 10
(5,352 Views)
Sorry Ray,
I know at least 1 way of connecting certain multiple RS-232 instruments on 1 line if you daisy-chain them.
This means that you connect the input of the RS-232 device to the output etc, forming a chain.
What these specific devices do is decode the incoming code an resend it to their output ports.
If the device has information to send, it adds it to this queue.

However, it seems that is not Dawe's problem.

Patrick de Boevere
Serenity systems design
0 Kudos
Message 6 of 10
(5,352 Views)
I have the possibility to program the device to send any format necessary. It is´nt quite finished yet so I have´nt decided what format to use. It´s kind of flexible so to speek.
0 Kudos
Message 7 of 10
(5,352 Views)
Gotcha!

How about variable length format (to allow for expansion).

Have device transfer the following series of bytes.

# bytes Contents
1 count of number of bytes that follow.
2 First Bytes of First value
3 Second byte of First value
4 First bytes of Second value
.
.
.

You could add a checksum of the total packet at the end if you want error detection.

LV can handle this format without any trouble. In fact one of the LV TCP/IP examples has an example where the client reads a bytes count from the port and uses that value to read the rest of the data.

I don't remember if you mentioned what dev system you where using.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 10
(5,352 Views)
I´m using LabView 6i(student version) on a iMac OS9.
How exactly would this expansion work? I´ve looked at the TCP/IP example you mentioned and I THINK I understand what you´re getting at. I still dont know how to build my diagram though. Do you have, or do you know where I might find an example to use as a starting point. I can´t possible be the first one with this specific comunication approach. It must have been solved before, dont you think?:)
0 Kudos
Message 9 of 10
(5,352 Views)
I suggest going to "search Examples >>> Hardware input and output>>>Serial"

If the student version work like the otheres you should find three examples.

Ask on if required, after you have taken a look.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 10
(5,352 Views)