LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication betwen microcontroller and labview

hi..im currently doing some data logger involving labview..here the data such as voltage,current,temperature and etc will be send from microcontroller to a pc by using serial com. im using labview serial write and read.vi example to grab the data..data that i received is in HEX display..so the question is how do i modified this vi to make sure all of the data are arrange in correct order and save it to spreadsheet?

0 Kudos
Message 1 of 10
(6,335 Views)

hi hohoi,

  I think in your program of reading data from serial port,you must be using a while loop.Then you just wire the string output from the VISA Read.vi to the border of while loop and enable indexing.Then place a write to spreadsheet.vi ,configure it for string input,make transpose as true and wire the string ouput from the while loop to the string input of write to spreadsheet function.

 

 

thanx and regards

srikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 2 of 10
(6,290 Views)

 


@srikrishnaNF wrote:

hi hohoi,

  I think in your program of reading data from serial port,you must be using a while loop.Then you just wire the string output from the VISA Read.vi to the border of while loop and enable indexing.Then place a write to spreadsheet.vi ,configure it for string input,make transpose as true and wire the string ouput from the while loop to the string input of write to spreadsheet function.

 

 

thanx and regards

srikrishnaNF


 

Well, that won't do much good in decoding the data.

 

The hex data can be converted using the String to Byte Array. From there, you can index the array and get the different elements. After that, it depends on how you encoded the data with the micro. It also depends on whether you have done something such as only sending data only at the request of the pc. If you just constantly send data, very difficult to determine which bytes you read are voltage, current, etc.

0 Kudos
Message 3 of 10
(6,285 Views)

how do i index the data?

the data such as voltage, current, temp and etc will keep sending to the pc randomly..so how do i arrange them accordingly?

im not so good in labview 😞

0 Kudos
Message 4 of 10
(6,278 Views)

Change the way the data is sent. The problem is not with the LabVIEW side. If you have no idea what byte x is, you can't 'arrange' them.

 

As I said, one way is only send when requested. Another is to use a prefix/suffix that you make sure does not appear in the data. Another is to send the data as ASCII with a terminator (i.e. V=xx.xCR)

0 Kudos
Message 5 of 10
(6,271 Views)

attached is my Hex display after the random send from my motor controller and the other one is my motor controller datasheet

can u show me how i can arrange it based on the given register used in that datasheet?

Download All
0 Kudos
Message 6 of 10
(6,263 Views)

Have you been paying any attention at all to what I've said? If the instrument is sending random data, you CANNOT decode it. There is a command that you can write to the controller and it will resond with data in a known order. Try that.

 

In the future, do not post an image that has no meaning, Pst the actual VI or a snippet (look it up).

Message 7 of 10
(6,255 Views)

When you say random send from the controller do you mean that it sends a packet periodically at random intervals? It sounds to me like you simply want to know how to index the fields. Is that what you are asking?

 

This example vi will take a tab delimited string and convert it to an array of strings. It then uses the index array function.

=====================
LabVIEW 2012


Message 8 of 10
(6,203 Views)

HI,

I am a beginner to Labview, and I want to create a GUI application in Labview where the user can enter the flowrate for the infusion pump , so I want the microcontroller (HCS12) to read the data(flowrate) and start running the program which is in microcontroller. Through my research I found that I have to configure the VISA write but dont know how to proceed ahead. Please help me this is my final year project..

0 Kudos
Message 9 of 10
(6,008 Views)

Which Microcontroller you are using ?

0 Kudos
Message 10 of 10
(5,798 Views)