Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Where do i start with RS-232 to recieve and analyse multiple signal using a single port?

Solved!
Go to solution

Hello,

I am beginning a new project that will have a single serial port.  I would like to use Labview to analyse multiple singles (which include two temperature measurements, two pressure measurements, and a couple of others like two voltages, shaft encoder input, etc..).   

Where should i start?  I understand RS-232 fairly well, but not as familiar with Labview.  How do i break apart the input to seperate the multiple inputs?

 

THank you all in advance for all the help you provide.

 

 

0 Kudos
Message 1 of 9
(4,331 Views)
Message Edited by Dennis Knutson on 03-10-2009 09:17 AM
0 Kudos
Message 2 of 9
(4,327 Views)

Arrgh. Problems posting.

 

You must be using a single instrument since you have only one serial port so how the instrument is formatting all of it's datra is going to be defined in it's manual. You haven't provided the make and model of the instrument but I would recomend you look first for an instrument driver.

 

Before trying to write any code, I would recomend you debug the connection with a program like Hyperterminal and you would also get familiar with the commands/responses from the instrument. Then you can try the shipping examples in LabVIEW for serial communication.

Message 3 of 9
(4,322 Views)

Hey deperkin,

 

Just to expand on what Dennis has already said, one of the examples that would be a good starting point for doing serial communication in LabVIEW is the Basic Serial Write and Read.vi example. You can find this example in the NI Example Finder. To open the example finder, open up LabVIEW and navigate to Help -> Find Examples... From here, verify that the Browse tab is selected and navigate to Hardware Input and Output -> Serial -> Basic Serial Write and Read.vi

 

If you have the make and model of your device, you might be able to find an instrument driver that we provide for this device. You can search for instrument drivers through LabVIEW by going to Tools -> Instrumentation -> Find Instrument Drivers... or by going to www.ni.com/idnet and searching for the drivers there

Message Edited by Justin E on 03-11-2009 01:14 PM
Justin E
National Instruments R&D
Message 4 of 9
(4,298 Views)

Thank you both very much.  I will do this.

 

Just to clarify a little more on my project:

 

I am using a PIC to control a solar tracker that will be used for steam generation.

This will include the following data that need to be transmitted over 1 serial port:

2 analog temperature sensors,

2 light sensors (in my case 2 GaP LED's used for measuring light),

1 analog pressure sensor,

1 rotary encoder,

1 Real-time clock

 

The PIC will be controlling the motor as well as the flow of water for the steam generation cycle.

 

Non of the parts are purchased yet, and i am specifying to my team to use I2C ready parts so we could use a bus.

 

What i would like to do is use Labview to view (not write to) the data and i need to seperate the data stream into the appropriate parts in order to graph them seperately.

 

I will look into what you both said and go through he tutorials.  I am not entirely new to Labview, but have never used much of the DaQ tools or serial port tools.

 

I know that there are some nice parts that we could buy from NI, but with budget constraints i believe we will have to hold off for now and try to primarily use the serial port.

 

Thank you again for all of your help.

 BR,

 

Deperkin.

0 Kudos
Message 5 of 9
(4,287 Views)
Now I don't understand your system. You were talking about RS-232 and now I2C. You cannot connect more than one device up to an RS-232 port and I assumed you were going to be using some sort of instrument with multiple sensor inputs. If it's your PIC that will be connected to multiple sensors, then the separation of signals will have to be done there. If not, then you would be better off connecting the sensors to an NI DAQ board and you wouldn't be using RS-232 at all.
0 Kudos
Message 6 of 9
(4,283 Views)

Yes you are correct here.  The plan is to connect the multiple sensors using I2C up the the PIC and the then send one single via 232 to Labview and seperate the signal into parts... i was thinking for example:

CR

Signal1_label

Signal1_data

CR

Signal2_label

Signal2_data

CR

Signal3_label

Signal3_data

CR

.

.

etc.

each of these being single byte lines.

 Then if possible to seperate these in Labview for a few graphs.

 

 

 

0 Kudos
Message 7 of 9
(4,265 Views)

Yes you are correct here.  The plan is to connect the multiple sensors using I2C up the the PIC and the then send one single via 232 to Labview and seperate the signal into parts... i was thinking for example:

CR

Signal1_label

Signal1_data

CR

Signal2_label

Signal2_data

CR

Signal3_label

Signal3_data

CR

.

.

etc.

each of these being single byte lines.

 Then if possible to seperate these in Labview for a few graphs.

 

0 Kudos
Message 8 of 9
(4,265 Views)
Solution
Accepted by topic author deperkin
It's unclear what kind of separator you will be using between the label and data but if it's not a CR, then the serial reads should be fairly straight forward. A VISA Read can be set to terminate on a specific termination character (i.e. the CR) so the VISA Read would be in a constant loop and then you would look at the label and if each is unique, a simple case statement could be used to assign the value to a specific indicator/array/shift register/whatever you are using to display/store the data.
Message 9 of 9
(4,253 Views)