10-31-2018 02:25 PM
Hi Everyone,
I have used LabVIEW a bit however my knowledge falls apart with Modbus.
I would like to control a simens V20 motor using Modbus RS485 2 wire.
I am using a cRIO 9045 to do this (no not a NI USB rs485).
I have established connection! I also can write to registers and see them update on the front panel. Terminating resistors being used and all.
However i cannot turn on the motor! Been working on this for 2 weeks with no joy.
To setup the inverter in modbus mode i have followed the v20 example modbus document on page 13. (CN011 setting, just puts it into Modbus mode)
Notice on the same document the first few pages show the control word STW. This is used to control/ turn the motor on and off. The register for this is shown on the other document (Inverter manual) if you scroll to the register table page 178. it requires that you send Hex 47E (get ready) then Hex 47F (Run motor). (More info on STW Page 17 modbus example).
I cannot write to this register as i get an error from the modbus API (see attached).
i understand writing to registers, however for safety i think the inverter needs a constant modbus connection. Should connection fail the motor turns off. This is (im guessing) what simens means by cyclic communication and is not described in depth in the manual (not really designed for labVIEW) "All drives of the port are to be operated cyclically, one after the other." page 7 inverter manual
.
Is it possible that the normal write command just wont cut it and recieves this error code?
Does anyone know why i get this error, or any ideas on what to try?
Thanks in advance, the help is very much apreciated!
Daniel
11-20-2018 08:33 AM - edited 11-20-2018 08:33 AM
Hey Daniel,
I'll hold my hands up to being totally ignorant in this area first.
I took a look in the manuals and I saw a reference to acyclic operation, which may allow for the motor to run without constant communication.
I also saw in the Modbus example PDF you attached that there is a warning on page 18 which says that:
If there is a communication failure, a running motor cannot be switched off via the bus between the start of the fault and the end of the telegram downtime (P2014).
This sounds as though it should not stop simply because it did not receive any communication?
Perhaps one of these is relevant?
Regards,
Mitch
11-24-2018 05:03 AM
I'm pretty sure I'm doing 47e then 47f. The real issue is I cannot write anything to the control word without it giving error. Even the wrong word would not go through.
Is there something else we need to do? I know with uss before messing with the Control word and off and on signal Is sent (but that's probably equiv to 47e and 47f)
11-24-2018 05:04 AM
Just to add on the bop nothing changes. It does not switch to 47e or 47f. It does not switch at all
11-24-2018 12:46 PM
(At this point I assume you are talking about the VI attached to the first message (Are you the same or a different user?))
Sorry, I don't have any of your subVIs (a project file does not contain any code!), but a lot of your code is highly flawed.
11-24-2018 01:10 PM
@altenbach wrote:
- You can probably combine your four inner FOR loop into one
or two.
Here's how that could look like. (Also, maybe you want to format as hexadecimal instead of decimal. Not shown)
Note that your version is just a giant mess using twice as many bytes because you are coercing all blue stuff up to I32 in the first "built array".
... and if you would define your diagram constant a little more conveniently, you would need no loops at all!
11-24-2018 01:20 PM
Hi Altenbach,
yes i am the same user, I have no idea how I managed two alias. (perhaps another account)
I have been playing around with this alot since this last post. Yes i did realise it was parallel eventually.
I am now using Hex as well, however the floating point representations 1150 convert to 47E and 1151 47F if i am correct (originally used that)
The real issue i think is something to do with Modbus API or like you say my code.
If I get rid of all the code and focus on the problem by opening a Modbus connection, then writing 47E and 47F to the control register I receive the error immediately when trying to write 47E.
The Inverter simply does not want to accept the values. Even thou it does for other registers.
Kind Regards,
Daniel
11-24-2018 01:23 PM
Hi Altenbach,
Thanks for pointing out the redundant code. Very good to learn from a LabVIEW Champion.
I will make these changes during work hours UK monday.
My biggest concern is the modbus connection issue. Would you have any thoughts on that?
Kind Regards,
Daniel
11-24-2018 01:37 PM
@FlyingKiwi77 wrote:
I am now using Hex as well, however the floating point representations 1150 convert to 47E and 1151 47F if i am correct (originally used that)
I did not see any floating point code. That would have an orange color.
What you are describing is not a conversion, just a different formatting. There is no change in the underlying data:
(Maybe your problem is just a basic misunderstanding of datatypes, conversions, and formatting.)
Sorry, I cannot comment on the modbus stuff because (1) I am not familiar with it and (2) all your subVIs are missing.
11-24-2018 05:57 PM - edited 11-24-2018 06:05 PM
@FlyingKiwi77 wrote:
My biggest concern is the modbus connection issue. Would you have any thoughts on that?
If it helps, there is no such thing as a Modbus connection or an RS485 connection, assuming that you are thinking about it in terms of a TCP connection. A tcp connection is a structure in memory that describes the tcp state machine. Modbus over 485 has no such state machine and thus no connection. The only thing that might exist would be a watchdog on the device side, which must be touched at a periodic rate in order to avoid the system going to a safe state. It looks like you want to set 40001 (holding register 0x01) to a value of 0 to disable the watchdog timer.
The error you got is simply modbus error code 4 -- meaning communication is working, and the device is responding to your request saying "I have a fault". Have you read back any of the alarm or fault registers (desc on pg 322) to see what they say? Page 175/76 says its one of:
Write to a read-only register
Write register, error in parameter access
Read register, error in Parameter Manager
Write to a zero entry
Unknown error