LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decoding serial data.

Solved!
Go to solution

HI Cory,

 

First all of this term talk was based on the last character being a "10" or "0A" in hex. If that is still the case try using

 

Instrument I/O >>> Serial >>> VISA Configure Serial Port to set-up your port. If you take a look inside that VI you will see there are anumber of settings that work together to set the term character behaviour properly. That VI understands what combos to use.

 

Try giving that VI a wirl.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 11 of 23
(2,340 Views)

You called it Ben.  I edited my code so that I polled the device twice.  The response to the first polling were the 64 bytes I showed earlier.  The response to the second polling were the missing 25 bytes.  I was able to parse them correctly and check the results against the measurements made by the Windows software that came with the device.

 

Thanks to everyone for their input.

 

Corey

Message 12 of 23
(2,314 Views)

If you disabled the termination char Labview should not behave like this. I am 100% sure your problem is that the termination char is enabled. Take a look at this sample on how to disable the term char. It is a Labview example

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 13 of 23
(2,309 Views)

Actually Mike Ravens and t06 called it (I gave them Kodus since their observations were the key).

 

Thanks!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 14 of 23
(2,308 Views)

Thanks Ben.

 

I'm still confused about the original poster's messages.  All along he swore that the termination character was not enabled.  In the VI he posted in message 10, the termination character Enable was set to False.

 

What ultimately fixed his problem?  Did he in some way actually have the termination character enabled?  Did what he say and what he posted not actually reflect his real application?

 

The only other possibility was that it took longer than the 500 msec wait he had to return all the bytes.  I doubt that, but it's possible.

Message 15 of 23
(2,288 Views)
If you open the "VISA Configure Serial Port (Instr).vi" you will find that it has a different approach in setting the term char, compared to the method used in post 10. I also noticed that this vi do not read a fixed a number of bytes. If you expect to receive xx bytes, you should read xx bytes or wait for timeout


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 16 of 23
(2,273 Views)

Here's the code that worked for me.  There may be a better way to do it but I didn't have time to dig further into it last night.  You can see I poll the device once, read the serial port buffer, wait 250 ms and read the buffer again.  I am not entirely clear why this works the way it does since I have the termination character disabled. 

 

In previous versions of this program I incrementally extended the waiting period to 10 s but never got the full configuration message.  I also tried hardwiring the "# of bytes at port" to 89 but still only got 64 bytes.

 

Corey

0 Kudos
Message 17 of 23
(2,272 Views)

Hi Corey,

i think someone already said it, but i didn't found it in your posted vi. See the "VISA Configure Serial Port" function for an example. I think you have to change also the "End Mode for Reads" to "None" (as shown in the example) to get what you need.

 

Hope it helps.

Mike

Message Edited by MikeS81 on 02-11-2009 03:58 PM
Message 18 of 23
(2,267 Views)
This is the basic way to solve your problem


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 19 of 23
(2,261 Views)

MikeS81 wrote:

Hi Corey,

i think someone already said it, but i didn't found it in your posted vi. See the "VISA Configure Serial Port" function for an example. I think you have to change also the "End Mode for Reads" to "None" (as shown in the example) to get what you need.

 

Hope it helps.

Mike

Message Edited by MikeS81 on 02-11-2009 03:58 PM

So the secret here was the Serial: End Mode for Reads which apparently overrides the setting for Termination Character Enabled?  I don't think I've ever used the End Mode for Reads.  I would have thought its default value would be None.

 

I've never had any issues before, but then again, I think I almost always use the Serial Port Configure VI.

Message 20 of 23
(2,258 Views)