LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Query format in MODBUS RTU PROTOCOL

Hii

 

Pl send me

 

1. query format for Modbus RTU Protocol with ODD Parity.

 

2. If query goes to instrument using ODD Parity then how to do Error Checking? should it be based on Parity bit checking or based on CRC bits ckecking?

 

vijtin

 

 

 

 

0 Kudos
Message 1 of 8
(4,237 Views)

Have you started by looking at the NI modbus library?  http://sine.ni.com/nips/cds/view/p/lang/en/nid/201711

 

Odd/Even parity is set up by the serial port.  It checks to make sure a single bit hasn't been corrupted in the byte.  If this happens (which is very rare), you'll get something like a framing error or parity error returned by the serial port.

 

CRC checking is handled by the Modbus library.  It checks to make sure one or more bytes haven't been corrupted in the entire message stream.  If this happens, the library functions will return an error.

 

Either way, there isn't much you have to worry about there as a programmer.

 

You may also want to check out these links.

 

http://zone.ni.com/devzone/cda/epd/p/id/6153

http://www.modbus.org/tech.php

0 Kudos
Message 2 of 8
(4,219 Views)

Hii

Thanx for support but I have idea regarding error checking methods using Parity or CRC.

 

I want to know only query format in Modbus RTU protocol while sending Parity Bit (either odd or even).

 

With Parity None my query format is...

 

01 03 0001 0002 C40B

 

Where 01 is address of device

            03 is readcommand

            0001 is starting location

            0002 is length of data which i want to read

         & C40B is CRC

 

 

Same as above example what will be the query format with Parity EVEN or ODD?

 

 

 

Plz help me.....

 

 

vijtin

0 Kudos
Message 3 of 8
(4,210 Views)

http://forums.ni.com/ni/board/message?board.id=170&message.id=417824&requireLogin=False

 

hope this helps

.......^___________________^
....../ '---_BOT ____________ ]
...../_==O;;;;;;;;_______.:/
.....),---.(_(____)/.....
....// (..) ),----/....
...//____//......
..//____//......
.//____//......
..-------
0 Kudos
Message 4 of 8
(4,201 Views)

What Ravens Fans said is that the parity bit is managed by the serial port hardware, so the query format is exactly the same for no parity, odd or even.

What changes is how the message is sent through the wire (which is not up to you); however, if you switch the parity bit on, you may get parity errors during read operation.

Of course, the instrument should also support the same parity settings.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 8
(4,198 Views)

Hii Paolo,

 

Thanx for reply.

but still i am not cleared......

 

My Labview software is Master, it will send query with parity bit to device & my device will work as an Slave during communication.

 

So my question is How my device will come to know whether query comming from Labview software is with ODD Parity or EVEN Parity?

 

vijtin

0 Kudos
Message 6 of 8
(4,192 Views)

Well, I'm confused enough. In my opinion, your question would be relevant if:

a) you are programming the device too

b) you are not using an UART to receive the serial communication, but rather trying to interpret the input bit-per-bit

 

If the device is using an UART, this chip must be setup in advance with the correct parity management, either EVEN or ODD or NONE. As far as I know, UARTs have no auto-set capability.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 8
(4,184 Views)
If you do not tell it what is the parity your device will not know, you need to use visa serial port, or a MB serial init to link it to the MB serial master query and there you can set the parity. At least this is what i think.
0 Kudos
Message 8 of 8
(4,181 Views)