08-11-2015 10:59 AM
Hi there,
I've been using labview for about a year and i'm working on a project which is involving a lot of arrays. I have accumulated all the data however i now need to send the data via UART (Serial). There is 6 parts that are required to be sent, 4 being 2D array and 2 DBL values. What would be the best way to go about this?
The order in which they are sent to serial must be as follows:
1 - DBL Value
2 - 2D Array
3 - 2D Array
4 - 2D Array
5 - 2D Array
6 - DBL Value
I was going to send the DBL value first by converting it to decimal string but the main issue is the 2D arrays. I've tried changing the write into an array however the serial wont accept it (Write function to serial). I've tried splitting the arrays into sperate colums however i still have the issue of sending the array over via write. Any help would be appreciated. I'm using labview 2012 SP1.
Kind Regards
08-11-2015 11:18 AM
I'm assuming you are able to control the Read and Write parsing on both ends of this serial communication. If not, please share the device information, or at least what the device will expect in terms of delimiters.
If you can control how you parse the data, why not just create your own set of rules/delimiters for writing and reading the data? You could send an "ArrayStart" string before you send an array and then used commas and semicolons to control rows and end-of-rows. If this works, then you can just convert your arrays to really long strings with the correct delimiters.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-11-2015 11:38 AM
You could combine all your data into a single cluster, and then flatten to a string, or XML, or JSON, send the string, then take that string and convert it back to the cluster.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-11-2015 11:44 AM
^ This ^
Ignore my post above if both sides of your serial communication are LabVIEW.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-12-2015 03:25 AM
I'm using labview to send the read write, however i'm sending data to a MSP430G2755 then it is returning data back through serial however this data is in ASCII.
Could i ask you to explain by what you mean your own set of rules? Right now i know from the code within the micro that if I send a certain character via serial, then the microchip is then expecting all these arrays and data to be sent along with it (To give a better understanding, I'm trying to convert a vb program to an automated labview program. I have managed to convert the rest of the code within the VB program, this is the last part.
The micro is expecting certain amounts of data and once its received them it then returns it. Here is a small snippet of the code in vb.
Pc to Micro:
For Loop_Count = 0 To 75 ' Send "unsigned int MSP_Heat".
Cal_SLong = MSP_Heat_Table(Loop_Count)
Buffer(Loop_Count * 2) = Cal_SLong And &HFF
Cal_SLong = Cal_SLong >> 8
Buffer(Loop_Count * 2 + 1) = Cal_SLong And &HFF
Next Loop_Count
SerialPort1.Write(Buffer, 0, 152)
Micro to PC:
for (Tx_Count = 0; Tx_Count < 76; Tx_Count = Tx_Count + 4) {
Send_UART_Message((unsigned int*) &MSP_Heat[Tx_Count], (unsigned int*) &VRef[Tx_Count + 2]);
By the input cluster do you mean something along the lines of the attached picture? I'm not very good when it comes to clusters so not sure if ive done that correctly,
Many thanks for your help
08-12-2015 07:30 AM
Here is what I was thinking. You may need to do some work with knowing when a transmission is complete, using terminating characters, or timing, with synchronous or asynchronous VISA settings.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord