LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

9 bit RS485 missing data...please help!

Solved!
Go to solution

Hi guys, I'm running a 9bit RS485 .vi and although I'm successfully getting most of what I need through without any problems (using the parity mark/space trick), there's a couple of problems.

 

It's to do with the headers I've set up; both are 5 characters, and although I can see all 5 present on our scope, LabVIEW is only showing the last 3 characters and I can't work out where the first 2 have gone or how to make them appear.

 

The funny thing is, one of our PCs does a similar thing but will only dispay the FIRST 3 characters of the header, not the last 3 like on our other 4 PCs. All our PCs are using Isolated 2 Port NI RS485 cards, though we are using a few different versions of LabVIEW, ranging from 8.2 to 2009.

 

Any help or tips would be much appreciated!

 

Cheers,

Matt

0 Kudos
Message 1 of 21
(6,825 Views)

Is LabVIEW reporting parity errors on the response?  If so, that could be your problem, because by default LabVIEW changes characters to 0x00, and there is a setting for LabVIEW to ignore null characters.

 

YOu can look at this thread to see an entry to add to your visaconf.ini file to disable the error replacement character.

Message 2 of 21
(6,805 Views)

Matt,

 

Is this 485 data a continuous stream or are you sending a command and reading a reply?

Message 3 of 21
(6,804 Views)

Hi Matt, thanks for that I'll look into it and see what comes of it.

 

Wayne, I'm issuing a command and waiting for a reply....each message contains a header, data and checksum. I hope that helps!

 

Cheers,

Matt

0 Kudos
Message 4 of 21
(6,779 Views)

Hi Matt, I should have realised in my last post but the PC we're running our .vi on doesn't have a LabVIEW licence - we're running an .exe so I can't check for parity errors. We are getting a new copy of LabVIEW in which we'll install on that PC so I can look into it in a day or two.

 

(I built the VI on my laptop which doesn't have a 485 card or USB 485 device so I can't use that)

0 Kudos
Message 5 of 21
(6,769 Views)

Matt,

 

Is the 485 communications 2 or 4 wire?  Has the USB-485 converter been configured to match in your vi?  If you are wired for 2-wire mode and the converter is set for 4-wire mode, you might be getting contention that is wiping out a couple of bytes.

 

Make sure you are configuring the COM settings in your vi.  Hook up the error cluster so that if a VISA error occurs in your .exe you can see what happened.

Message 6 of 21
(6,754 Views)

Hi again Wayne, cheers for your help.

 

Yeah I'm all setup; both the RS-485 PCI card I'm using and the .vi itself are set to 2-Wire Auto. I've also hooked up the error cluster and I don't think there's any errors, or any of the parity errors that Matthew mentioned, but to be honest, I've never used these error clusters before so I'm not sure what I'm looking for.

 

I've inserted a few indicators to see whats being written and read where (I have a full version of LabVIEW now to play with it so no more .exe's)....the data is being written fine, it's just that when it goes to read the 1st byte, the 1st one it pulls out is what should be the 3rd byte. This is particularly strange with the command message as it s written then immediately read with no delays or any other processing! 😕

 

Thanks,

Matt

0 Kudos
Message 7 of 21
(6,730 Views)

Matt,

 

When you look at this with a scope, how much time between end of transmission from PC to beginning of reply from target?  Can you post your code?

Message 8 of 21
(6,718 Views)

It's hard to tell since I can't find myself a diff probe for the 485 bus, but there's pretty much no delay anyway...you can see on the scope that the CMD request is immediately followed by the CMD Acknowledge msg, similarly with the Status Request and Status message. Is there a delay that's required for this to work in LabVIEW? When I borrowed a better scope last week that can read the individual bits over the bus, I did establish that all the data is there, so I definitely know that its LabVIEW thats missing it....I just can't work out why!

 

I work in the aerospace industry and things being tightly controlled as they are, unfortunately I can't post the code. Is there anything specific you'd be looking for? Are there certain delays you have to put in for 9bit 485 to work properly in LabVIEW?

 

I'm sorry I can't be more help... 

 

Matt

 

 

0 Kudos
Message 9 of 21
(6,702 Views)

Matt,

 

Here are a couple of things I've seen happen.  One is clearing the RX buffer in your vi between sending a command and reading the response.  The other is a hardware issue and happens when a 485 device does not switch from TX to RX mode fast enough. 

 

Can you post a simple generic example of how you are using the NI-VISA functions?  

Message 10 of 21
(6,698 Views)