LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read frames from serial port using MRU protocol

Solved!
Go to solution

Thank you very much.

The files "MRU Comms 8_2" and "MRU Parser tester MAIN 8_2" are still in the version 9.

I changed my vi and I created 2 binary files that I attach. (I used textpad to open them.)

I also try to show the date in numeric values, from the byte array that is created from the string data that is read from the serial port.

But the problem is that in every run, the values change.

In all fields tha values change each time the serial port is read. So, when I select specific items of the byte array, they are different is each run.

 

 

Download All
0 Kudos
Message 11 of 23
(1,122 Views)

Sorry about that, for some reason i always have problems when saving for previous versions. Pretty sure its something im doing and not a LabVIEW problem. Anyway, i have tried again and i will take a look at what you have sent me.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 12 of 23
(1,106 Views)

Hi Nik,

 

After looking at the files you sent me its becoming a bit clearer now. After going back through the pdf i have realised that i misunderstood the sending of shorts and longs. I thought that because the shorts had (16) next to them and longs (32) this referred to the bit length but it actually refers to the amount of bytes sent. The data sent for these is a cluster with some bytes being ASCII units which explains why the data you are getting has lots of ASCII data that i couldn't account for. Seems to be making more sense now.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 13 of 23
(1,102 Views)

Thank you again for your help.

But, the problem is that I cannot parse the data successfuly because the positions of data that are described in the protocol do not remain the same. For example, when I parse the bytes from 4 to 9 to get the date, I get different values for every run, of the while loop. The fields in the Front Panel show it clearly, when I run the program and I have the machine connected to the serial port.

How can I get over this?

Thank you very very much for all your time you spent for me.

0 Kudos
Message 14 of 23
(1,094 Views)

Hi Nik,

 

I have had a look at the files you sent me. It appears to me that you are not reading all the data that is being sent to you. The data seems to look like chunks of what you would expect to get but not complete. There is no 'MRUj' ascii string in the whole file and this is the start of message identifier. I have attached updated versions of my software for you to try out. Let me know how you get on.

 

On your vi where you are trying to concatenate a string, remove the empty string constant, this is stopping you from doing this. You should then get an accumulation of all the data you are getting.

 

Also, maybe try in your loop where you are reading bytes from port having a bit of logic that sets the TRUE case for the read only if >1000 bytes are read. Make it a number that guarantees catching at least two complete message. Send me what you read. I have a feeling you are getting gaps in your data by the way you are reading it.

 

Try using the vi i have sent you as i implement an internal buffer.

 

Let me know how you get on and have a happy new year.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 15 of 23
(1,087 Views)

Hi Nik,

Like Lucither said there is no "MRUj" start message in the log file which you sent. also i am not sure about the message protocol (.pdf) document. it is better to check with your team for the correct message format.

Then it is easy to explorethe data.

 

Have a very happy new year Smiley Tongue

 

 

0 Kudos
Message 16 of 23
(1,083 Views)

Happy new Year!

I will come back with the results.

0 Kudos
Message 17 of 23
(1,073 Views)

Happy new year to you also.

 

I have attached another Zip file here. Realised whilst working on a seperate project today that your 8_2 version will see a problem if a blank array is passed to the CRC loop. This would not happen in the 2009 version as i use a for loop which would not iterate in this circumstance.

 

Rgs,

 

Lucither.

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
Message 18 of 23
(1,059 Views)

Hello,

I occupied again with the project and I finished it.

I read successfully the serial data from the MRU VarioPlus gas alanyser and I attach the specified vi file.

But, I didn't succeed to write properly tha data in txt files in real time. This piece of code is in a disabled structure. The problem is that the array that is used to store temporarily the data that are received at each batch of serial data, is continuously appended to each self. Any hints for this problem is appreciated.

0 Kudos
Message 19 of 23
(906 Views)

nikosfs,

 

You might want to try to use dataflow to choose what part of the array you are writing to file.  As it stands, you are using variables, and so you can't quite be sure exactly what you are writing to file because nothing is guarenteed to execute before the other.  If you directly wire the part of the array you want to write, you shouldn't have a problem doing whatever manipulation you need to do.

 

Hope this helps,

 

Jen W

Applications Engineer

National Instruments

ni.com/support

Message 20 of 23
(877 Views)