04-14-2021 05:16 AM
The code snippet used below is used to write RPM values to a Variable Frequency Drive over the MODBUS RTU - RS485 Communication Bus.
Works OK for CW rpm as the value written is 0 to +5000 for a speed of 0 to 1450 rpm.
But communication fails when I try to enter negative values for RPM and I get a time out error. As I can see LV converts the negative RPM values to corresponding HEX using 2's complement method and processes the command. But though the drive manual says to write negative values to get CCW rpm, not sure why it fails.
If there anything wrong in the code snippet ?
04-14-2021 05:25 AM
Hi Moga,
@MogaRaghu wrote:
If there anything wrong in the code snippet ?
How should we know when you don't supply information on your VFD…
04-15-2021 12:37 AM - edited 04-15-2021 12:41 AM
Oh ... sorry.
Attaching the document which my vendor gave me. No need to waste time on whole document - chapter 8 has all sample codes for 16bit / 32 bit Read and Write.
Of course nowhere it mentions about negative value as parameter but that is an information from supplier who says its done like that in PLC based control systems.
Thanks
04-15-2021 01:54 AM - edited 04-15-2021 01:58 AM
Hi Moga,
@MogaRaghu wrote:
Attaching the document which my vendor gave me. No need to waste time on whole document - chapter 8 has all sample codes for 16bit / 32 bit Read and Write.
Thanks for the manual!
@MogaRaghu wrote:
But communication fails when I try to enter negative values for RPM and I get a time out error.
Did you read chapter 6.5? It explains the responses of the VFD!
When you send a request, but don't get a response, then there are two possible reasons given in this chapter.
I guess it's the 3rd item in this list which applies here…
04-15-2021 05:01 AM
@GerdW
Thanks
Yes I also saw that and possibly the main issue is with the command string formatting. Will look into why. Maybe I will try to use the Plasmionique Modbus master VIs instead of the simple VI snippets that I now use and see if there is any improvement.
As to the third entry it says in the failed case I dont get a response. It makes trouble shooting that much more tough. When the going gets tough, the tough get going. So....
04-23-2021 11:18 AM
I am trying to control a Nidec drive over Modbus RTU.
All required commands and address have been validated using ModScan 32 app. Working well.
Tried to use the same parameters in a simple VI. But so far i have been met with only Illegal Address / Comm Time out / Undefined errors.
This same setup works with a Bonfiglioli drive with only change in address and command values. SO this means basically nothing wrong with the code.
Just wanted to know if there are any tools to capture the actual data transaction between the PC and drive.... I can atleast compare both data transactions when using Modscan32 and then my LV Code.
Any pointers to solution welcome.
04-23-2021 11:32 AM
You wrote the value of 40642 as your register. That doesn't work in Modbus. The actual register address is 641. You need to strip the prefix of 4 and subtract 1.
Modbus annoying classifies the different groups of registers with a prefix number (3 for input registers, 4 for holding registers, 1 for discrete inputs, and to just confuse things more, 0 or basically "nothing" for coils.) And to add more confusing, when they use the numbering scheme with prefixes, they start at 1. But the actual registers are 0-based like pretty much anything in the computer world.
Take a look at this link I found to try to remember the prefix for the coils and discrete inputs. It does a decent job of explaining it.
And why aren't you using the Modbus libraries for LabVIEW you can find in VI Package Manager?
04-24-2021 01:54 AM
@Ravens
Please attach the mentioned link for recalling the prefix for coils etc
Also I did a traffic capture for the following setup :
Device ID : 0x01
Function code : 0x03
Address : 642
Command word : 449
As you can see from the attached image of capture, I am able to identify above in different parts of the capture. But cannot correlate with what is group that goes from PC to VFD and what comes from VFD to PC. I think if this is clear then I can modify my code to generate in line with same.
Thanks for your support !!
04-24-2021 12:32 PM - edited 04-24-2021 12:34 PM
I don't completely understand your question.
The part in grey is from the PC to the VFD.
Slave Address 1
Function code 3 (Read Holding Registers)
Starting address: 0281x is 641 decimal. So that would be 40642. It seems like your modscan32 software took the 0642 you entered (basically and subtracted the 1 for you). Since the prefix of 4 (for holding registers) 3 (for input registers), 0 (for coils), and 1 (for discrete inputs) when you look at the full 1-based address you often find in manuals for modbus never actually is transferred into the real message with the 0-based address, it just gets dropped. Interesting enough, the manual you attached earlier never mentions them. It just gives you the basic non-prefixed, 0-based address.
Length of 1 address
Last two bytes are checksum.
The part in black is the response from the VFD to the PC.
Slave Address 1
Function code 3 (Read Holding Registers)
2 data bytes coming
Data: 01C1x is a decimal value of 449
Last two bytes are checksum
Unfortunately, in the manual you attached earlier, I could not find any definition of what address 641 (0-based) or 40642 (prefixed, 1-based) holding register is supposed to be. Or even what 642(0-based) or 40643 (prefixed, 1-based) means, if that is what you were trying for.
Here is what your it would look like in LabVIEW using an older Modbus library that I like the best and the same parameters your Modscan screenshot is doing.
Note: this only runs on 1 time. You can add to this to make it run in a loop.
04-25-2021 05:16 AM - edited 04-25-2021 05:44 AM
The part in grey is from PC to VFD and so should contain the following :
Device address
Function Code
Starting Param Address
Number of registers
Command word
CRC
My query was on the absence of the command word from the real time trace - without this how does the VFD know what I intend to tell it to do ?
With regard to the Modbus library I see only the Plasmionique Modbus Master and the NI Modbus Library in the VIPM browser. Where do you get the one you developed the snippet on ? I have seen this earlier but not sure if its still around ...