Machsupport Forum

Mach Discussion => Brains Development => Topic started by: skippy on January 17, 2011, 09:57:04 AM

Title: Help with Modbus I/O with Brains
Post by: skippy 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)
Title: Re: Help with Modbus I/O with Brains
Post by: Greolt 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
Title: Re: Help with Modbus I/O with Brains
Post by: poppabear 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
Title: Re: Help with Modbus I/O with Brains
Post by: Greolt 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
Title: Re: Help with Modbus I/O with Brains
Post by: poppabear 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
Title: Re: Help with Modbus I/O with Brains
Post by: Greolt 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
Title: Re: Help with Modbus I/O with Brains
Post by: Greolt 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
Title: Re: Help with Modbus I/O with Brains
Post by: Greolt 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.

Title: Re: Help with Modbus I/O with Brains
Post by: poppabear 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
Title: Re: Help with Modbus I/O with Brains
Post by: Greolt 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



Title: Re: Help with Modbus I/O with Brains
Post by: Greolt on January 19, 2011, 06:43:09 PM
YAY !!!!!!!!   IT WORKS !!!!!!!

Thanks very much to Scott, Peter and Paul for the help.

Now I look at the settings and see they really are very basic.   I don't know why I struggled so much to get it going.  Obviously I am not so smart.

A couple of pics of the settings for any reading this who are interested.

Greg
Title: Re: Help with Modbus I/O with Brains
Post by: poppabear on January 19, 2011, 08:10:22 PM

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

OEMDRO99 ranges from 0.0-1.0  so that would give you a range of 0-4000

scott
Title: Re: Help with Modbus I/O with Brains
Post by: Greolt on January 19, 2011, 08:37:33 PM

OEMDRO99 ranges from 0.0-1.0  so that would give you a range of 0-4000



OK I get it.  I have never used that DRO. 

I use "Overriden spindle speed DRO  202 "  Which reads in RPM.   So as the max RPM is 24,000  then I divide that by 6 to give max value of 4000 out to VFD  (400hz = 24,000 RPM)

Anyway thanks very much for your help so freely given.  It is much appreciated.

Greg
Title: Re: Help with Modbus I/O with Brains
Post by: skippy on January 29, 2011, 07:23:47 AM
Update

Got it working today. The Brains worked with no problems. Our mayor problems beside the ones about the VFD Manual not right about the coils offsets was a cheap Chinese USB to RS485 converter we have tried another converter which worked but also gave use Blue screens of death as well. which also had the same chip set as the Commfront adapter both share the same chip and driver. The variation in performance is therefore not centered around these components rather other areas of difference between the two devices. The Commfront device seems to offer additional features including opto-isolation, static protection and in built 120 ohm terminating resistors.
     
This adapter - worked faultlessly. http://www.commfront.com/USB-Serial-Adapters-Converters/Isolated-USB-RS232-RS485-RS422-Converter.htm

Thank you  to all that Helped

Regards skippy
Title: Re: Help with Modbus I/O with Brains
Post by: sebba on April 08, 2011, 01:41:31 PM
Hello,

I have a DZB200B Fulling inverter and I've make 2 brains for spindle control.
The first brain is for passing commands for FWD RUN, REV RUN and STOP and the second brain is for speed setting (RPM)

In the first time the both brains was running OK (on my home computer, for testing only) but after more testing and "improvements", the first brain stop working. More exactly, the brain seems running but the RUN/STOP commands aren't passed to the VFD. Even a saved brain or a new created brain for RUN/STOP don't pass commands to the VFD.
Second brain (speed setting) still running OK and also the RUN/STOP commands could be manually passed to the VFD.
I blamed the W7/64bit and I "moved" both brains to the workshop where Mach3 is running on a 32bit XP.

Initially everything worked as expected but after 2 days (and maybe some Mach's configuration modifications), the SECOND brain stop working.
In the same way like before.
So, the second brain (for setting spindle speed) seems to be working (in brain view) but it's output value is not passed to the VFD.
I also can set this value manually so I suppose is not a communication problem


Another problem, with the third brain: Third brain is for reading the spindle speed. And the brain seems to run OK but the reading value is not passed to the Spindle speed DRO, OEM 39. This is happening on both computers and this brain was never pass this value to the DRO.


Any hints for these issues? Many thanks in advance,
Seb
Title: Re: Help with Modbus I/O with Brains
Post by: skippy on May 06, 2011, 08:31:36 PM
As some people have asked for the working Brains attached in the "VFD Brains_working.zip" are both Brains VfdRun.brn and VfdSpeed.brn also have attach the screenshots from the Brain editor for each of the Brains.

Regards

skippy