From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MOXA, RS-485, ModBus RTU

Hello. Sorry about my English. I need help. The task is to get the data from the device and display it on the screen. The exchange Protocol of the device ModBus RTU. Device communication cable with MOXA CP-134U-I (RS-485) Board. I created a register test in labview, but the program indicates an error. Tell me what I'm doing wrong. (this is my first experience with labview)

Download All
0 Kudos
Message 1 of 52
(3,706 Views)

Hi,

 

The code you provided states that you want to read register 0 to 10.

Are those registers available in your device?

 

Second thing is the error you captured. It is error 56 which means the timeout.

Are all connection settings correct? (Parity, BaudRate, UnitID, etc.)

 

 



0 Kudos
Message 2 of 52
(3,678 Views)

Default communication channel settings
- Interface type RS-485
- Exchange rate-9600 baud
- The length of the parcel is 8 bits.
- Parity - no
- Number of stop bits-1
The network address of the device and some parameters of the communication channel are configurable-
they are installed directly in the device using the configuration SOFTWARE.
2. The exchange is carried out according to the algorithm: the request of the master-the answer is known-
go. Radiation monitoring devices are slave devices-
you.

 

Team 04. Placement of data in registers. Measured value in Bq / m3, format
representation of numbers IEEE-754 Single.

Register 0 Hi Bits [8..15] the activity values of gas
Register 0 Lo Bits [0..7] activity values of gas
The Hi Register 1 Bits [24..31] activity values of gas
The Lo Register 1 Bits [16..23] the values of activity gas
Register 2 status Bytes

Register 3 Reserve
Register 4 Reserve
Register 5 Reserve
The Hi Register 6 Bits [8..15] values of count rate is the main channel
The Lo Register 6 Bits [0..7] the values of the counting rate – main channel
Register 7 Hi Bits [24..31] count rate values-main channel
Register 7 Lo Bits [16..23] the values of the counting rate – main channel
Register 8 Hi Bits [8..15] the value of count rate – background channel
Register 8 Lo Bits [0..7] the value of count rate – background channel
The Hi Register 9 Bits [24..31] the value of count rate – background channel
The Lo Register 9 Bits [16..23] the value of count rate – background channel
Register 10 Hi Bits [8..15] activity warning setpoint values
Gaza
Register 10 Lo Bits [0..7] gas activity warning setpoint values
The Hi Register 11 Bits [24..31] activity warning setpoint values
Gaza
The Lo Register 11 Bits [16..23] activity warning setpoint values
Gaza
Register 12 Hi Bits [8..15] gas activity alarm setpoint values
Register 12 Lo Bits [0..7] gas activity alarm setpoint values
The Hi Register 13 Bits [24..31] the value of the alarm setpoint activity gas
Register 13 Lo Bits [16..23] gas activity alarm setpoint values
Hi, The Register 14 Bits [8..15] dry contact (gas activity) setpoint values)
The Lo Register 14 Bits [0..7] dry contact (gas activity) setpoint values)
Register 15 Hi Bits [24..31] dry contact (gas activity) setpoint values)
Register 15 Lo Bits [16..23] dry contact (gas activity) setpoint values)
Register 16 Resource-senior word
Register 17 Resource – the low-order word
Register 18 date (see below)
Register 19 Hi Time: Clock
Register 19 Lo Time: Minutes
Register 20 Hi Time: Seconds
Register 20 Lo Time: Seconds/100
Assigning bits in the status byte.
Bit 0 (LSB) installation Failure 0-OK, 1-failure
Bit 1 warning threshold Exceeded 0 - not exceeded, 1 –
exceeded
Bit 2 alarm threshold Exceeded 0 - not exceeded, 1-exceeded
Bit 3 test mode Indication :
0-normal mode
1-testing (ignore bits 0, 4, 5, 7).
Bit 4 main channel Status 0-OK, 1-failure
Bit 5 background channel Status 0-OK, 1-failure
Bit 6 availability of pumping 0-OK, 1-no
Bit 7 flow indicator Status 0-OK, 1-failure
Bit 8 (MSB) Indicates the test mode of the installation systems (except counting
channels') :
0-normal mode
1 - testing installation systems (ignore bits 0, 6, 7).
Assignment of bits in the word "date".
Bit 0..Bit 4 Day (number)
Bit 5..Bit 8 A Month
Bit 9..Bit 15 Year
The team of 16. Placement of data in registers .
Register 10 Hi Bits [8..15] activity warning setpoint values
Gaza
Register 10 Lo Bits [0..7] gas activity warning setpoint values
The Hi Register 11 Bits [24..31] activity warning setpoint values
Gaza
The Lo Register 11 Bits [16..23] activity warning setpoint values
Gaza
Register 12 Hi Bits [8..15] gas activity alarm setpoint values
Register 12 Lo Bits [0..7] gas activity alarm setpoint values
The Hi Register 13 Bits [24..31] the value of the alarm setpoint activity gas
Register 13 Lo Bits [16..23] gas activity alarm setpoint values
Hi, The Register 14 Bits [8..15] dry contact (gas activity) setpoint values)
The Lo Register 14 Bits [0..7] dry contact (gas activity) setpoint values)
Register 15 Hi Bits [24..31] dry contact (gas activity) setpoint values)
Register 15 Lo Bits [16..23] dry contact (gas activity) setpoint values)
Register 18 Date
Register 19 Hi Time: Clock
Register 19 Lo Time: Minutes
Register 20 Hi Time: Seconds
Register 20 Lo Time: Seconds/100
Assignment of bits in the word "date" - see " command 04. Placing data in the register".

I tried different settings (Parity, BaudRate, UnitID, etc.)

 

0 Kudos
Message 3 of 52
(3,640 Views)

I'm sorry I didn't say Hello )

Hi

I used to communicate and configure the device standard program on the interface rs-232 (it is designed to configure the device through specialized SOFTWARE), but the measurement results are obtained through the channel rs-485 )

0 Kudos
Message 4 of 52
(3,636 Views)

Your example code have baudrate set to 19200 but you say the device accepts 9600.

Be sure that the UnitID is correct. You didn't write if you are sure of the UnitID parameter of your device.

 

If you are sure that all comm parameters are correct try to read one register, not 10. For example register 18 - Date.

 

 



0 Kudos
Message 5 of 52
(3,624 Views)

I a bit not understand as this do correctly, there where I have 2 constants need to put 1 and 17 ?

 

0 Kudos
Message 6 of 52
(3,594 Views)

No, you need to put 18 to the first constant (register), and 1 to the second constant (count).



0 Kudos
Message 7 of 52
(3,568 Views)

I tried to change the constants, but the result is the same error

 

0 Kudos
Message 8 of 52
(3,548 Views)

It seems like a communication issue.

Are you able to communicate with the device using other tools (like MODSCAN, or something similar)?



0 Kudos
Message 9 of 52
(3,531 Views)

Tried to communicate via Modbus polling, a timeout error appears. Tried through standard Max tools (Performance Analyzer and PComm monitor)

0 Kudos
Message 10 of 52
(3,504 Views)