Hello Guest it is March 28, 2024, 09:21:44 AM

Author Topic: Help with Modbus I/O with Brains  (Read 22430 times)

0 Members and 1 Guest are viewing this topic.

Help with Modbus I/O with Brains
« on: January 17, 2011, 09:57:04 AM »
Can someone help and tell me where I' going wrong

Here are my ModBus Configuration Screen

Also I have tested thought the <Test ModBus> button I'm are able to read and write to Coils and Holding Registers but when the brains a running they don't update the VFD coils or Holding Registers.

Also included the two brains VFDrun and VFDspeed screen Snap shoots

I think my problem is when I add the ModBus input or outputs as seen in the Add input screen shot

I'm no sure what setting to us for the following

Enter ModBus Address to use?
I know it's an output when it's and output and input then it's an input
Source?

I have tried all different settings

I have also read the Users_Guide_for_Brains

I think this is where I'm getting stuck is on the follow passage

Quote
ModBus: this is where the money shot is, here you enter the ModBus address to use this is the Local Address starting at 0, (unless in the TCP
config you told it to start at a different Local address for that Cfg). Local Address “0” corresponds to your first “starting
address” of your external device for that Cfg.

As my slave is node 1 and the Address is 0001h for the coil or 001h for the Holding Register why do enter in 0 and when I do it doesn't work ?

Any help would be much appreciated
Regards

Paul (skippy)

Offline Greolt

*
  •  956 956
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #1 on: January 17, 2011, 06:32:30 PM »
Paul I am not going to be much help but am very interested to follow your quest.

I have tried so many things that, for the time being, I have given up.  :)

Shouldn't  the source be set to "Serial Plugin Enabled"?

Greg

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #2 on: January 17, 2011, 10:37:39 PM »
Several things............

   1). Please dont take this in a bad way, but re-read the Brains guide......  your missing some concepts there.....

2). Ok, in your Modbus set up dialog, you will need to convert HEX modbus addresses to Decimal addresses (see guide).
Double CHECK your Modbus addresses in your VFD, to make sure you are addressing your IO correclty....

3). Once you can control your VFD (all functions that your trying to control), from the Modbus Test Window, your 1/2 there.

4). Remember this (and it is a little confusing, I admit), the Modbus OUTPUTs from the VFD are the Modbus INPUTS in the modbus dialog window in mach3, and vice versa going the other way......

5). you will need ONE config for each "Type" of modbus you use: I.e. (Input Coils/discrete inputs, Output coils/discrete outputs, holding is holding). If you get it working in the Modbus test window then you have it right.

6). In Brians, if you are using the "Plugin Enabled Serial Modbus" (which in your pics you are), then in Brians you will need to set the modbus protocol type to "Plugin enabled modbus" (you have yours set to something else).

7). NOTE!!!!!!!!!!!  when you put in your "start address" for a config, the Local Var starts at "0" not "1", UNLESS you are changing this on purpose........

8). Your outputs in Brian MUST also correspond to the matchine config that you choose for you outputs, and again, you must SET the Using Plugin enabled serial modbus!!

9). Critical, and often overlooked thing on Brians......  When ever you edit/modify/create a Brian, you MUST!!!!  "Reload all brains", even WHEN you THINK you see your brains name in the list!!!!!, Make sure you have the Enable Brain CHECKED for that new or modded Reloaded Brian!!!!!

10). For testing Purposes, I would HIGHLY, HIGHLY recommend you get some kind of Cheap secondary Computer monitor, so you can run Mach on one screen, and your "View Brain" (from the button of same name), so you can watch the items change state as you test you system, to debug your Brain.

scott
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #3 on: January 18, 2011, 01:29:58 AM »
I have got Mach via modbus to turn the spindle on and off.  Yay!!!!!  At last!!!

The settings that I ended up with in the brain lobe termination made no sense but they worked.

I am using the X200 for testing, which does not have the removable control panel.  This means that the control panel is still connected when the cat5 cable is plugged in.  Unlike the SJ200.

So I set the A001 to 00.  Which means the potentiometer still controls speed manually.  And A002 to 03. which sets modbus to control run command.

This is what I had to do before modbus would turn the spindle on.  On the other hand, if A001 was set to 03.  (modbus speed control), then run command via modbus would not work.

I presume the reason for this is because the modbus controlled speed is sitting at zero revs.  Just as if the pot is turned all the way down.


When I "view brain"  I can see the output change with spindle speed override slider.    Also, importantly, the return value from VFD goes up and down too.

This says to me that the VFD is getting the speed signal.  But it is having no effect.

So am I sending the speed signal to the wrong register or something?      I wish I knew.   But at least I have some success.   ;D

Greg

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #4 on: January 18, 2011, 03:55:22 AM »
Quote
So am I sending the speed signal to the wrong register or something?      I wish I knew.   But at least I have some success.

yes, most likely this is the case....

Here is a few things to look for on your VFD, see how many Bit resolution your speed control input from the modbus is, i.e. 12 bits would be 4095 in decimal. So look at your VFD book, find out how to configure the parameters for Analog speed control over modbus, and make sure you have the Correct address!!!!, in your Mobus dialog, use a seperate config for speed control, it is usualy a holding register, so from modbus in mach, your ana out would be an Output holding register.......  On average that is.

Given the above, and assuming lets say that your ana out is on Config 1, and was the first address of that config, same as the start address.
you brain would be:

Spindle Speed % DRO 99 > Formula  A * 4095 > Plugin enabled Serial modbus out, config 1, local var 0

Scott
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #5 on: January 18, 2011, 08:43:02 PM »
I have made some progress.  :o

Now I can operate the run command, direction command and speed (or frequency) command,  all via the "Test Modbus" dialogue.

I had not succeeded with this before, so was getting ahead of myself, playing around with the modbus configuration.

Now I need to translate those commands over to the serial plugin modbus, to be controlled via brains.  Run command works no problem.  Speed command is where I fall over.

Here are some screen grabs of the "Test Modbus" dialogues with the numbers that work.

Greg

Offline Greolt

*
  •  956 956
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #6 on: January 18, 2011, 10:22:58 PM »
So now armed with that information I proceed to set up "Modbus Configuration"  as well as the brains to send the appropriate data.

The first configuration (Cfg #0) works fine with the run command brain.  No problem there.

The second configuration (Cfg #1) along with its speed control brain is where I am stuck.

Here are a coup[le of relevant pages of the Hitachi manual.  

Full manual PDF link,  driveswarehouse.com/documentation/Hitachi/SJ200M.pdf


Greg
« Last Edit: February 19, 2013, 12:44:20 PM by Chaoticone »

Offline Greolt

*
  •  956 956
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #7 on: January 18, 2011, 10:30:34 PM »
And here are my Modbus Configuration page and the brain termination dialogue.

Reading the manual it suggests to me that I should be entering 40001 + offset somewhere.   But that just gets rejected whenever I try.

And the coil numbers suggests similar (30001 + offset) but clearly works without any reference to any such number.

Seems to me the key info I am getting wrong is the places marked in my pics. 

"Modbus Var" on the configuration page "Cfg# 1"   (Cfg# 0 works as is)

"Enter Mobus Address to use" on th ebrain termination dilalogue.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #8 on: January 19, 2011, 12:35:58 AM »
Here is the way I am reading it from the manual:

   you will need to set parameter:
A001 = 03
A002 = 03
your modbus port speed is set to:
9600, same in the VFD, but once you get it all working
you could set C071 = 06, and modbus to 19200.

Note: according to how your manual reads, for your digital output coils, your modbus BASE starts at (in the VFD in decimal), at 30001,
so, for your two discrete outputs, you would need your offset plus your base, cnf#0,so Address Modbus (var) would be 30002, 2 registers, output coils (see attached screen shot).

for your spindle speed out, you would use cfg#1, address base is 40001 plus the offset so, start address for where the speed register is, is 40003 and only 1 register since that is the only holding your writing to, output holding type.(see attached screen shot).

in brains, your st brain that handles your do, (note, you CAN put this on ONE brain since you can define the modbus cfg per modbus IO.

so since you have your DO working here is the DA (speed out).

DRO99->Formula(A*4000)->Serial Plugin Modbus, Modbus address to use would be "0" since your output holding is the first (and also the start) address, tick "output", tick "Serial Plugin Enabled", put a #1 in the CFG.
(see second screen shot......)

Save that brain, close the IDE, in mach, RELOAD ALL BRAINS!!!!, highlight your speed output brain, make sure it has the enable tick checked. VIEW BRAIN, so you cna MDI spindle speed and see if you see your run for the speed out, changing.

IF...................  I say again IF!!!!!  I am reading your manual correclty for the offsets, that should do it, NOTE, make sure you remember to TEST this with the MODBUS config Test window and you match the modbus screen shot., make sure you tick the RUN modbus as well.

scott
fun times

Offline Greolt

*
  •  956 956
    • View Profile
Re: Help with Modbus I/O with Brains
« Reply #9 on: January 19, 2011, 03:57:51 AM »
Scott

Let me say first up that I appreciate very much you taking the time to look at this and respond with suggestions.

Quote

   you will need to set parameter:
A001 = 03
A002 = 03
your modbus port speed is set to:
9600, same in the VFD, but once you get it all working
you could set C071 = 06, and modbus to 19200.


Yes I have all that.  As i said above, communication has been checked in the "Test Modbus" dialogue.  That is all OK.


Quote
Note: according to how your manual reads, for your digital output coils, your modbus BASE starts at (in the VFD in decimal), at 30001,
so, for your two discrete outputs, you would need your offset plus your base, cnf#0,so Address Modbus (var) would be 30002, 2 registers, output coils (see attached screen shot).

for your spindle speed out, you would use cfg#1, address base is 40001 plus the offset so, start address for where the speed register is, is 40003 and only 1 register since that is the only holding your writing to, output holding type.(see attached screen shot).

This is where it gets interesting.  I have Mach successfully writing to the coils, with this setting at zero instead of 30,002.  See pic in my post above.

When I try the setting to 30,002 as in your modbus config pic.  It no longer will write to the coils.

So it is working with zero and will not work with 30,002

Also on looking more, some PDF manuals have no mention of this number, and some do.  Go figure.  :D

Quote

DRO99->Formula(A*4000)->Serial Plugin Modbus, Modbus address to use would be "0" since your output holding is the first (and also the start) address,
 tick "output", tick "Serial Plugin Enabled", put a #1 in the CFG.   (see second screen shot......)


Yeah got all that.  I know about reload brains etc.  

The only bit that I do not get is  Formula(A*4000)  

It is actually A/6 this gives the correct out put range the VFD needs.  0 to 4000  ( 0 to 400hz )

Greg