Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

9bit data in RS 485 communication

I am trying to communicate with an RS 485 instrument. The communicaiton protocol is as follows.

It uses a 11 bit asynchronous tranmission mode with 57600bps baudrate. It include 1bit start bit (0), 9 bit data bit and 1bit stop bit (1). The difference with the normal serial instrument is the 9bit data. In LabVIEW VISA / Serail VIs supports only upto 8 bit data. Is there any way to use LabVIEW to communicate with the instrument with 9 bit data? Is there there any other third party tools which supports the 9 bit data in serial communication.

Thanks in advance for your help.

- Senthilnathan A.
0 Kudos
Message 1 of 10
(8,768 Views)
One thing you can do is use the parity bit. However, this will require you writing a function or VI that is able to interpret the last bit and then set the property for the parity to be Space or Mark. You will need to change the parity for each byte and therefore you will only be able to send one byte at a time, unless you place enough intelligence into the function so that it can figure out if a whole string of bytes will require the same parity. It isn't pretty, but it will work. Just out of curiosity, what kind of device uses 9 data bits?

-Josh
Message 2 of 10
(8,753 Views)
Hi,

As Josh said, parity can be used as the 9th bit and an applictaion can be written for further interpretation. If you want to go for a seperate hardware then you can actually think of NI 7831R FPGA card which can be programmed to work for the specific IO protocol. RS 232 example applictaion on that card is actually available at ni site. So you can modify that example for your specific protocol and use the hardware.

Regards,
Siddu
0 Kudos
Message 3 of 10
(8,733 Views)
Thanks Josh and Siddu. I have used the parity for the 9 bit to communicate with the instrument. The instrument is an amplifier used in a network control and monitor application.

Thanks,
Senthilnathan A.
0 Kudos
Message 4 of 10
(8,724 Views)
I decided to see if I could make this work and I ran into a problem. When you enable parity NI-VISA configures the UART to replace bytes that have a parity error with a parity error replacement byte. You can change the byte to anything you want, but you can't turn it off. This means you can create an application that transmits 9-bit data bytes without any problems, but you won't be able to ready 9-bit data without getting parity errors that result in the data being replaced.

From what I can tell the only work around would be to read the data twice. Once with Space and once with Marked Parity and then combine the data that isn't a parity replacement character.

I hope this helps.

-Josh
0 Kudos
Message 5 of 10
(8,723 Views)

How can i read the serial data twice?

If i run a VISA read does this not clear the port, therefore if i try a second read with a different parity there would be nothing in the port left to read?

0 Kudos
Message 6 of 10
(8,331 Views)

Hi,

In a test setup I have I use RS-485 interface with a 9 data bit protocol.

The devices use this 9th bit to mark the first byte of a frame. With the fixed parity and character replacement in case of a parity error I managed to communicate with the devices. It works also because this is a single master system.

Can this help you ?

 

Sorry, reading the date's and see that this thread is 2 years old !!!

Message Edited by K C on 03-14-2007 03:45 PM

0 Kudos
Message 7 of 10
(8,328 Views)

That sounds very much like the system i am working with.

I am emulating a master for an aircraft system that uses 9bit RS485 protocols.

I can transmit a 9th bit as an address bit as the first byte in a message, but the slave responds with the 9th bit set to show it is the start of the message but i keep getting the error replacement byte.

Some people have said read the byte twice so that the contents can be seen, but i do not know how to do this. The byte is the first of between 5 and 150 bytes, so it can only be sent once.

Any information you have will be useful.

(I relasise this is an old thread....but some problems live forever....)

0 Kudos
Message 8 of 10
(8,324 Views)

OK, this is what I do:

send the first byte with a mark parity (9th bit set) this is the address of the destination.

send the second byte with a space parity (9th bit reset) this is the address of the master. because this has to be the forst byte of the return answer I use this for a replacement character.

send the remaining byte with the same space parity.

Receive all bytes with a space parity. When the first byte comes in a parity error occurs and the replacement character is filled in.

Because there is also a CRC check in each fram I can check if there is a error.

It's a bit tricky in the receiving part but for a test setup and with the CRC check it will do fine.

Message Edited by K C on 03-14-2007 04:03 PM

0 Kudos
Message 9 of 10
(8,325 Views)

You can also buy a board that supports 9th bit communication.

http://www.generalstandards.com/   or http://www.sealevel.com/ and i am sure there are more.

Or have fun and make it yourself with a 8051 processor

 

0 Kudos
Message 10 of 10
(8,310 Views)