06-10-2024 03:10 AM
Hello,
I am trying to control a controller manufactured in China, which is used for managing the load of a hysteresis magnetic brake. My goal is to operate this controller via LabVIEW using the Modbus RTU protocol over RS485. However, I am unable to send instructions to the controller successfully. The controller came with only one document, which I have included along with pictures of the controller.
I would greatly appreciate any examples or ideas that could help resolve this issue.
06-10-2024 06:59 AM
What have you tried?
Are you using NI Modbus Library Toolkit for LabVIEW?
06-10-2024 07:56 AM
I am trying to send the example message "01 10 00 00 00 02 04 00 00 00 14 F3 A0" found in the bottom right corner of the attached image to the controller. The controller operates by sending a specified current, from 0 to 2000mA, to a brake. This example sets the current to 20mA. Once I can send this message successfully, I will be able to adjust the values as needed. I am using the NI Modbus Library Toolkit.
06-10-2024 09:06 AM
Do you get an error message?
From what I can read, this should work with the default settings. Function code 0x10 is Write Multiple Holding Registers, code 0x05 is Read Holding Registers.
The top of the instructions is missing, so I guessed the datatype of the setting is u32. Type casting works because it assumes big-endian encoding ("High in the top")
06-10-2024 12:05 PM
I am not getitng any errors message, but unfortunately, my knowledge of Modbus communication is not sufficient to independently write the code in LabVIEW. Instead, I am using examples from the internet and adapting them to my needs. That’s why I’m seeking help here to find a solution.
I will attach images for reference.
06-11-2024 03:22 AM
The Write Multiple Holding Registers in the snippet above will write that message. Download the snippet, drag it onto the block diagram and take it from there.
06-11-2024 05:33 AM
Do you have any suggestions on how to resolve this?
06-11-2024 07:33 AM
That error means the device fails to answer in time, which could have lots of different reasons. Is it still on?
How did you implement the loop? I would imagine that this error occurs intermittently, so as long as you clear the error after each iteration it should eventually start responding again.
06-18-2024 08:32 AM
06-21-2024 03:48 AM
Check the error code and if it matches, clear it. There is a "Clear Error" VI for this. You should make sure that you only clear it a limited number of times in a row, so that you do not miss a permanent disconnect.