LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

9 bit RS485 missing data...please help!

Solved!
Go to solution

Generically, this is how I'd run a 9bit VISA serial link and read 5 bytes from it:

 

VISA Comms.png

 

 

 

 

0 Kudos
Message 11 of 21
(3,335 Views)

Matt,

 

Don't see anything wrong with your method.  Is this generating any VISA errors or warnings when it only reads 3 of the expected 5 bytes?

Message Edited by Wayne.C on 08-20-2009 11:07 AM
Message 12 of 21
(3,322 Views)

If you probe the error cluster right afte rthe read, you are not getting any errors?  I would have expected a parity error, because you would be in space parity and the device replying would be sending some data with mark parity.

 

Did you try to add the INI setting I linked to before?  If LabVIEW is seeing any kind of error on those bytes, by default it replaces them will null characters and drops them.  You can also change the error replacement byte using a VISA property nodeunder Serial Settings (where the Parity property is) by setting the Error Replacement Character and setting it to something other than 0.  You also can set the Property (same location) for Discard NUL Character to FALSE and any 0x00 characters will be returned.

Message 13 of 21
(3,319 Views)

Hey guys, sorry about the really late reply but I was on holiday last week.

 

Anyway, back to work...I don't have any idea what I'm really looking for in the error out string, but when I probe the error out its very quickly flickering between 2 states, an OK state with a green tick which reads:

 

Warning 1073676294 occurred at VISA Read in 9bit Driver.vi->***interface name***.vi

Possible reason(s):

VISA:  (Hex 0x3FFF0006) The number of bytes transferred is equal to the requested input count. More data might be available.

 

 

And a 'Not OK' state with a red cross which reads:

 

 

Error -1073807254 occurred at VISA Read in 9bit Driver.vi->***interface name***.vi

Possible reason(s):

VISA:  (Hex 0xBFFF006A) A parity error occurred during transfer.

 

 

Note that I've inserted "***interface name***" myself as the file name gives away the project I'm working on which I can't disclose on here. I did try the INI setting but it seemed to only make things worse - all the data disappeared!

 

Anyone know what might be causing this...??

0 Kudos
Message 14 of 21
(3,283 Views)

Matt_M,

 

In his previous post, Matthew Kelton predicted the parity error and explained why.  You need to modify the .ini file to disable the 'error replacement character'.

Message 15 of 21
(3,276 Views)

@ Matthew Kelton

 

Hey Matthew, thanks for your advice. I'm just trying to put in this .INI fix you've described. I've changed the ini file but I'm still getting parity errors. How exactly do I go about replacing the charcters with bytes I want to specify, as opposed to 0x00 or null characters. I've tried using the 'Replace Character' instruction on the serial but I can't seem to get it working.

 

I've putting the replace character instruction directly before and after where I read the data, but nothing seems to be changing and probing the error out still tells me theres a parity error. Do you know where I'm going wrong?

 

Thanks again,

Matt

0 Kudos
Message 16 of 21
(3,210 Views)

You will still get the parity errors, as the INI file setting woes not hide the error, it just disables replacing the charaters.  So you will have to handle the error in your code, but the data coming from the read shouldn't be modified any more.

 

If you have put the INI file setting in, then the Replace Character property has no effect as it has been disabled.  If you remove the INI file setting, then you can place the property right after you open the COM port.

Message 17 of 21
(3,193 Views)

Cheers Matthew, I'm with you now. I'll try and work with the ini setting in. How do I go about "handling" the parity error though? Is there a way to correct it?

 

Sorry to be such a noob, but I'm new to LlabVIEW!

 

 

Matt

0 Kudos
Message 18 of 21
(3,187 Views)

Since I've come in this morning and booted up the lab pc, comms has appeared to stop working. All I'm getting through is 1 byte of data (and not the right one), where the command acknowledment should be.

 

However when I delete "DisableErrorReplacement=1" from the ini file and restart LabVIEW it all seems fine again, and goes back to only receving 3 of the 5 characters of each header, my original problem. Then when I change the ini file back to include "DisableErrorReplacement=1" it goes back to just getting that one byte through.

 

Does anyone have any light they can shed on this? Is this being caused by the parity error I'm now not nulling or replacing with zero as its everywhere across the bus when "DisableErrorReplacement=1" is in the ini file??

 

Thanks,

Matt

0 Kudos
Message 19 of 21
(3,177 Views)
Solution
Accepted by topic author Matt_M

That probably means it's working.  I had forgotten, but what also happens when you have the DisableErrorReplacement set is that you will not necessarily get all your bytes back, so you will need to run your VISA read in a loop until you get all the characters or a timeout error.

 

There are many ways to handle an error, from ignoring all errors and not using the error cluster wire, to using the cluster tools or the error cluster wire to determine the error code and drop the error if it only matches a specific code.

Message 20 of 21
(3,167 Views)