Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple sensors connect to PIC Microcontroller

Hi,i am new in labview ,i am trying developed a data acquisition system where 5 sensors connected to the AD channel of PIC microcontroller and  its sending data serially to PC .I  am getting data in labview but i can't differentiate data ,how can i represent separately each sensor value in Labview.

0 Kudos
Message 1 of 28
(7,569 Views)

Hi,

 

There's a few questions I want to ask to get a better idea of your application.

 

1. Are you using VISA commands to communicate with your microcontroller?

2. How is the data represented right now? Is it an array of numbers? Is it just a long list of numbers and you don't know what corresponds to what?

3. Can you clarify what you mean when you say you can't differentiate data? Are you getting all the data and just don't know how to put them into their own arrays? Or are you having trouble figuring out what data corresponds with what sensor?

James F.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 28
(7,540 Views)

Thanks for your replay

 

1. I am using VISA commands to communicate with  microcontroller.

2.Microcontroller reading each sensor sequentially and it sending data in string format to PC,It  not sending any sensor number with data.   

3. I am  getting all the data and just don't know how to put them into  arrays and i do not know how to represent separately .As an example 5 temperature sensor connected to a microcontroller which reading each sensor individually then sending by serially .How i can represent that 5 temperature sensor value in labview by 5 temperature meter.

 

I  heartly expecting your kind attention .  

0 Kudos
Message 3 of 28
(7,536 Views)

Start with separating all values by e.g. a tab character and each set of (you said 5) datapoints with a LF character.

Tab is ascii 9 and LF is ascii 10 both decimal.

 

In that way you have minimal overhead.

If you want to have the PIC an easier time don't send the data as strings but as integers and convert to floats in LabVIEW.

But that is an optimization in speed and size.

 

In LabVIEW start reading until you get a LF.

Then keep reading and put the data (until you get at a LF) into a row of DBL (floating point numbers).

 

The conversion of a row of numbers is easiest with convert spreadsheet string into array.

 

If it does not work out send us a long string with content and your subvi that tries to do the job. 

greetings from the Netherlands
Message 4 of 28
(7,530 Views)

Albert

Thanks for your help.Now i am getting separate value from each sensor by "LF" at the output of read buffer.But i having problem to put them into array and represent  each sensor value individually . I  want to represent five sensors value to five meters.Could u help me

0 Kudos
Message 5 of 28
(7,491 Views)

this is what you want but i think you may have some problem in your code to read from visa are you sure your device do not need any comment to write to send the data?

Message 6 of 28
(7,467 Views)

Hatef,

Thanks for your replay .you got me what i want ,Your assumption is right now i am facing problem .All data going to first  temperature meter only ,how to solve this issue.

0 Kudos
Message 7 of 28
(7,462 Views)
do you have your PIC microcontroller comments manual ? you have to read that to start
0 Kudos
Message 8 of 28
(7,458 Views)

Hatef ,

I read the PIC comment manual,The data coming from PIC are separate by "LF" also i am getting five separate value?I think u did not get me.Suppose I am getting five value Such as( 40,45,50,55,60) and there are 500ms Delay between two value now i want to put them five separate temperature  meter.In your suggested program only first meter showing that five value sequentially.

0 Kudos
Message 9 of 28
(7,452 Views)

do you get these 5 data Simultaneously from hatware ?or by to by?

0 Kudos
Message 10 of 28
(7,446 Views)