取消
显示结果 
搜索替代 
您的意思是: 

Modbus RTU over RS485 with CRC16

Hi everyone,

I try for the first time to communicate with a Joy-It DPS 5005 power supply with Modbus RTU.

But somehow I am missing something and fail. Therefore I would like to ask for your help.

The device requires the address code (1 byte), the function code (1 byte), the register starting address (2 bytes), the number of registers to read (2 bytes) and the CRC checksum (2 bytes)

The device address is 10. I want to read a holding register. So the function code should be 3. The register starting address is 0 and I want to read 2 bytes.

The CRC checksum of 0A 03 00 00 00 02 is C5 70.

My first trial was simply using Visa write and send the string 0A0300000002C570 followed by Visa Read. But I always got timeouts and no answer.

JoachimH_0-1732098410702.png

 

Then I thought of using the Modbus API library, created a Modbus instance as new serial slave and then used the Read Holding Registers VI. This didn't work, either. Is it because of the CRC checksum? I don't know how to send it

JoachimH_1-1732098449297.png

 

 

I would appreciate every help.

 

 

0 项奖励
1 条消息(共 11 条)
1,839 次查看

Why are you using the slave API? Usually the device being communicated is the slave and you use a Master to communicate with it.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 项奖励
2 条消息(共 11 条)
1,833 次查看

Have you in any way confirmed that the hardware is connected correctly?

 

Modbus connectors come in all sorts and sizes, and there's not really a standard wiring.

 

Some devices use Sub9 connectors, and Rx\Tx on 2\3, some use 5\8... You really have to read the manuals of both ends of the connection...

 

And I do agree that you should make a master, the device is a slave (answering to commands).

0 项奖励
3 条消息(共 11 条)
1,777 次查看

It was a first shot.

I was not sure if the Slave API is meant to communicate with a slave although knowing that my computer is the master.

I retried with the Master API and could at least send a command. 

JoachimH_0-1732269269890.png

The device also sends an answer. But the computer does not get it: Error 56 occurred at RTU Data Unit.lvclass:Read ADU Packet.vi:5030001

0 项奖励
4 条消息(共 11 条)
1,752 次查看

I am aware of the mess with connecting devices to RS485. But the communication with another device not using Modbus RTU works fine. And I am also able to communicate with the Jo-Its if I use the app of the manufacturer.

Nevertheless I seem to have still hardware issues. If I connect the Joy-It directly tot the RS485 interface of the computer I can send commands but do not receive a reply. If I use an RS485 to USB converter everthing works fine.

 

But coming back to Labview. Is the CRC16 checksum automatically calculated by the Modbus VIs?

 

0 项奖励
5 条消息(共 11 条)
1,747 次查看

@Joachim.H wrote:

But coming back to Labview. Is the CRC16 checksum automatically calculated by the Modbus VIs?


Yes.

0 项奖励
6 条消息(共 11 条)
1,718 次查看

@Joachim.H wrote:

I am aware of the mess with connecting devices to RS485. But the communication with another device not using Modbus RTU works fine. And I am also able to communicate with the Jo-Its if I use the app of the manufacturer.

Nevertheless I seem to have still hardware issues. If I connect the Joy-It directly tot the RS485 interface of the computer I can send commands but do not receive a reply. If I use an RS485 to USB converter everthing works fine.


How do you connect 'directly' to the computer?

 

Do you have a RS485 card in your computer?

0 项奖励
7 条消息(共 11 条)
1,713 次查看

When i had to intreface RS485 devices, i was using a serial-to-usb adapter, and it turned out i had to select the RS485 mode from Windows' Device Manager!
Maybe you could take a look there.

Another thing is, i have seen many Modbus devices having 2 Stop bits, and not 1 as per default Serial Port settings.
Also, does your device have a factory program? In this case, you can sniff the serial commands flowing.
Good luck

0 项奖励
8 条消息(共 11 条)
1,708 次查看

Yes, I have configurable COM-ports.

0 项奖励
9 条消息(共 11 条)
1,699 次查看

My devices need 8N1.

Unfortunately I have no access to the source code of the manufacturer's software.

0 项奖励
10 条消息(共 11 条)
1,697 次查看