Machsupport Forum

Third party software and hardware support forums. => Modbus => Topic started by: Sinij kot on May 18, 2011, 01:20:23 AM

Title: WJ200 low and high range hex frequency data
Post by: Sinij kot on May 18, 2011, 01:20:23 AM
I had the X200 working fine until I killed it  :-[  I needed to get back to running so I ordered the WJ200 drive thinking that it will be a direct swap with X200 as far as Modbus control goes.  Turns out WJ200 uses slightly different format for some holding registers.  In X200 all I needed to do was to send 0-4000 decimal number to the holding register and that would set the frequency.
In WJ200 that range is 0-40000 due to increased resolution 0.01Hz so this probably why it requires data to be sent in HEX format and split up between two registers (see the picture below)  I also included a picture of an example from the manual that describes what I need to do.
 
How can I convert decimal to HEX in brain and then split the value for two different registers?  Is this even possible in brain?

Link to the manual, pg `342
http://www.hitachi-america.us/supportingdocs/forbus/inverters/Support/WJ200_Instruction_NT325X.pdf (http://www.hitachi-america.us/supportingdocs/forbus/inverters/Support/WJ200_Instruction_NT325X.pdf)

Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on May 18, 2011, 02:52:34 PM
After making a post last night I went back to the shop to see how the holding register for frequency is read, to my surprise I discovered that frequency register 0001h was actually being updated properly.  Below is a picture of the brain I'm using to write registers.  The terminator for MOD:0-P:1 gets decimal input, is mach converting it to HEX when it sends it over ModBus?  It looks like that's what is happening.
This seems inconsistent with manual which says that registers 0001h and 0002h needs to be written for frequency.  I can change the register 0001h value and I get frequency set properly in the drive in Hz so that seems to be working it just doesn't make sense to me.

I have a different issue now, I can't seem to be able to control the motor ON OFF.  The brain seems to be set up correctly but I get no response.  I was having problems controlling it through the modbus test window, the data was read fine from both coils and registers but when I try to write it I get "illegal data value" when writing to coils and "unknown error" when writing to registers.  I think I may know why thou.  It probably has to do with 0000h being inaccessible so it cannot be written to.  I will give it a try again with starting coil set to 1 and not 0.

This still doesn't explain why the brain is not controlling the RUN/STOP, but if I get it working through the test window I might realize why.
Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on May 18, 2011, 07:50:06 PM
Now I'm really confused  ???.  I verified that I can read and write holding register for the frequency just fine either from modbus test window or using brain that I posted previously.

The problem is with coils.  I can read coils and receive 0 or 0000 I can also write back 0 or 0000 but I get an error when I try to write 1 or 0001.

I have checked and rechecked and rechecked again all the settings associated with modbus everything seems proper.

I tried everything I could think of at this point, all that's left is to beg for help.

Help  :'( help  :'(
Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on May 19, 2011, 09:42:50 AM
I did some more testing and still can't find the problem.  Using the serial monitor program I recorded what was sent to the drive.

Writing 0 to coil 0001:   01 05 00 01 00 00 9C 0A  I get no error
Writing 1 to coil 0001:   01 05 00 01 00 01 5D CA I get "unknown error" message and the coil doesn't change

The format looks fine to me.  I'm about to call Hitachi to see if I can get some support.
Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on May 19, 2011, 11:50:56 AM
Spoke with Hitachi and was sent the attached document, after reading it everything still seems fine.

The example 3 in the document describes exactly what I am trying to do.

I also downloaded the ProDriveNext drive programing software from Hitachi and will play with that to see if anything jumps at me.
Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on May 23, 2011, 10:23:09 AM
Made some progress on the coil writing issue.

From modbus test window if I write to coil 0 this value "FF00" the spindle turns ON and if I write "0" or "0000" the spindle turns OFF.
What I found is that the manual for X200 drive seems to be wrong bacause for X200 I could write "1" and "0" to turn ON and OFF.  The modbus section of both manuals is pretty much the same in fact WJ200 manual has X200 references which shows that the section was copied and edited but not carefully checked.

Anyway, now the question is how do I write FF00 to coil1?
I used the serial port monitor to see what message is going out to the drive when I turn ON the spindle from test window.  That message is:
01 05 00 00 FF 00 8C 3A
and to turn OFF:
01 05 00 00 00 00 CD CA

So from test window function 05 is used to write to the coil.
When I setup modbus and brain to write to the same coil, function 0F is used. This function writes data in consecutive coils vs. 05 which writes data in a single coil.  This might be O.K. but I can't make the value to come up as FF00.  It looks that there is a binary to HEX conversion when writing to modbus, so I tried writing 255 which equals FF in HEX but no luck, I think the message comes out with a value 00 02

An interesting observation is after I write FF00 to turn ON spindle and then read the current value back I actually get 0001
Title: Re: WJ200 low and high range hex frequency data
Post by: cncalchemy on August 22, 2011, 08:35:13 AM
Hi Sinij,

How did you go with your WJ200? did you end up getting it running with modbus? Im curious to hear your findings as i have one of these on order and planning on doing the same.

Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on August 25, 2011, 09:35:50 AM
I did make it work after getting help on yahoo group.  There are discrepancies in the Hitachi manual as far as modbus goes.  I'll have to double check, but I think the attached file is my latest brains to make WJ200 work.  I need to grab the actual brains from the machine.  There are curve correction multipliers to make the RPM read correctly for my mill.
Title: Re: WJ200 low and high range hex frequency data
Post by: cncalchemy on August 25, 2011, 06:50:15 PM
Thankyou Sinij, ill try it out.
Title: Re: WJ200 low and high range hex frequency data
Post by: cncalchemy on August 31, 2011, 05:30:55 PM
Hi Sinij,

would you be able to provide a screen shot of your modbus configuration page in mach please? im struggling a little as the video tut's for mach show the old interface for modbus configuration.
Also did you get a chance to get the updated brain from your cnc machine?

Thanks in Advance

Kind Regards
Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on December 06, 2011, 09:08:34 AM
Someone asked me to post the actual brain that I'm using.  Here it is.  I should post the MODBus set up screen as well.
Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on December 07, 2011, 09:23:37 AM
Here is the modBus set up screen.
Title: Re: WJ200 low and high range hex frequency data
Post by: kregan on January 25, 2012, 12:50:36 AM
Thank you posting the info on WJ200.  I just purchased one and got it set up but
had now idea were to start.

From what I have read so far I use a com port from computer but what about the plug
on the WJ200.  Do you know were I can find a pin out of the cable or instructions on what
I need to make?

Thank you for the help.
Title: Re: WJ200 low and high range hex frequency data
Post by: Sinij kot on January 25, 2012, 03:39:35 PM
From what I have read so far I use a com port from computer but what about the plug
on the WJ200.  Do you know were I can find a pin out of the cable or instructions on what
I need to make?

You need an RS232 to RS485 converter if using com port.  You can also USB to RS485 converter.  A cheap converter from ebay didn't work for me with WJ200 I had to go with a B&B converter  http://www.bb-elec.com/product11.asp?sku=485ldrc9 (http://www.bb-elec.com/product11.asp?sku=485ldrc9)
Title: Re: WJ200 low and high range hex frequency data
Post by: kregan on January 25, 2012, 11:44:05 PM
Ouch!  I though I could just make a cable. 

Thanks for the link... I guess I'll be ordering one if that is the only option

From what I have read so far I use a com port from computer but what about the plug
on the WJ200.  Do you know were I can find a pin out of the cable or instructions on what
I need to make?

You need an RS232 to RS485 converter if using com port.  You can also USB to RS485 converter.  A cheap converter from ebay didn't work for me with WJ200 I had to go with a B&B converter  http://www.bb-elec.com/product11.asp?sku=485ldrc9 (http://www.bb-elec.com/product11.asp?sku=485ldrc9)
Title: Re: WJ200 low and high range hex frequency data
Post by: bloomingtonmike on August 26, 2013, 11:35:44 PM
Bringing this topic back up.

I am trying to figure out how to make teh WJ200 work with modbus.

My setup will be different - I will be running mine with a 60hz 2.5hp 3phase Baldor I am putting on a rong fu 30 mill drill.

I really want to understand how modbus works rather than just configuring it.

I watched the Mach videos from Peter but they are centered around his modio card his utility rather than setting them up manually.

Any advice on a easy to learn approach to setting this up?

Also - Are you guys using the RJ45 connector on the WJ200 for modbus? The manual reads like you have to use the SN/SP terminals.  Says the RJ45 is only for remote operator.

Did anyone find a cheap modbus adapter rs232 to rs485 they KNOW works with the WJ200? I have one that works with my X200 but was not sure on the WJ200.
Title: Re: WJ200 low and high range hex frequency data
Post by: kregan on August 27, 2013, 09:05:27 PM
Just to follow up and clarify my posts... I ended up controlling my spindle via the breakout board and never used the MOD bus.
Title: Re: WJ200 low and high range hex frequency data
Post by: bloomingtonmike on August 28, 2013, 06:35:49 PM
A call to Hitachi confirmed that on the WJ200 the RJ45 port is NOT for the modbus connection. Here it is in the manual as well.

(http://i39.photobucket.com/albums/e169/BloomingtonMike/Craftsman%2012%20Metal%20Lathe/modbusconnector_zps88322cfe.jpg)
Title: Re: WJ200 low and high range hex frequency data
Post by: bloomingtonmike on September 01, 2013, 04:46:26 PM
OK I confirmed I cannot run Modbus using the RJ45 on the WJ200. Works perfect on the terminals though. This is kind of nice because you can run the op panel on the RJ45 and still control via modbus on the terminals

I also did not need a fancy modbus controller. In fact mine was less than $6 shipped. Search for "New 9 PIN RS-232 to RS-485 Adapter Interface Converter" from seller id eherebuy in Roselle Park, New Jersey, United States if you want to see the exact one I bought.

I have it working off a built in serial port on one computer and a PCI Rosewill RC-03 2serial1Parallel card from amazon installed in a second computer. Both work great.

(http://i39.photobucket.com/albums/e169/BloomingtonMike/CNC%20Millport/adaptereherebuy_zps449ea12c.jpg)

A link for as long as it will work to the RS485 adapter I confirmed worked with a WJ200
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=190539776031 (http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=190539776031)
Title: Re: WJ200 low and high range hex frequency data
Post by: bloomingtonmike on September 01, 2013, 05:40:49 PM
Couple of WJ200 setting things important to remember.

If you are using a brand new drive - Do the power test and verify the Drive works.

Then when ready, connect up and change:
A001 to 03
A002 to 03
Verify all your settings for com speed (c071 to c078)
then once everything is set/stored/saved
POWER OFF YOUR WJ200, wait 5 min (I waited about 1 min and it was fine), Then POWER IT BACK ON (or reset it) - You need to do that before Modbus control will work
TX+ on RS485 adapter to SP on the Hitachi WJ200
TX- on RS485 adapter to SN on Hitachi WJ200
Verify your serial port settings on the PC, make sure they match the inverter, and set those in Mach as well.
Title: Re: WJ200 low and high range hex frequency data
Post by: cncbaltar on September 16, 2013, 05:10:02 PM
Couple of WJ200 setting things important to remember.

If you are using a brand new drive - Do the power test and verify the Drive works.

Then when ready, connect up and change:
A001 to 03
A002 to 03
Verify all your settings for com speed (c071 to c078)
then once everything is set/stored/saved
POWER OFF YOUR WJ200, wait 5 min (I waited about 1 min and it was fine), Then POWER IT BACK ON (or reset it) - You need to do that before Modbus control will work
TX+ on RS485 adapter to SP on the Hitachi WJ200
TX- on RS485 adapter to SN on Hitachi WJ200
Verify your serial port settings on the PC, make sure they match the inverter, and set those in Mach as well.

I have a WJ200 and I am have a heck of a time getting mod bus to work..  Curious of others settings for testing it.  I have read all of Sinji posts including finding the thread that he supposedly got help on at Yahoo.

I am using a USB to RS485 specifically MWE820B at USCONVERTERS this one: http://www.usconverters.com/index.php?main_page=product_info&cPath=75&products_id=311
The way I have everything connected is as Bloomingtonmike said above, of course I read the manual to verify and all looks right to me.

I am using mach3 Full paid version R3.043.066
Modbus has been enabled within Mach 3
Simply using the Test ModBus function I am able to connect to my COMM port and I have connected the RS-485 terminals to a data analyzer and can confirm I am writing data to the WJ200 but nothing at all happens.
I believe the data formats for everything is incorrect but NOBODY including Hitachi can seem to verify anything for me.  Can somebody simply tell me what I should be typing into the Test ModBus window to make a simple run command work?
Here is what I am typing:
PortNum: 10 (of course everybody is different)
BaudRate: 57600 (again each to their own)
SlaveAddr: 1 (My WJ200 is also set to 1)
StartC: 0  (This is my biggest unknown according the WJ200 Manual Section B-24 Run command is 0001 but in the Hitachi Example 3 that Sinji provided it should be 2 what ever the case I have tried 0, 1, 2 and gotten nothing to happen.
NumCoils: 1
Data: Currently writing 65280 however I have tried 0001, 1, FF00, 255 none work

WJ200 settings are what the manual recommend and correspond to my COM settings:
Then when ready, connect up and change:
A001 to 03
A002 to 03
Verify all your settings for com speed (c071 to c078): done these match my PC COMM settings
then once everything is set/stored/saved
POWER OFF YOUR WJ200, wait 5 min (I waited about 1 min and it was fine), Then POWER IT BACK ON (or reset it) - You need to do that before Modbus control will work
A+ on USB->RS485 adapter to SP on the Hitachi WJ200
B- on USB->RS485 adapter to SN on Hitachi WJ200
GND on USB->RS485 adapter to GND on Hitachi WJ200

Yes I did the whole power off to reset my WJ200 with latest settings  I have also power cycled the PC and Mach3 to verify settings are set and look good.

Now where things get a little sketchy for me:  I decided to make sure data was coming out of the USB->RS485 converter by hooking up a serial data bus analyzer.  On the A+ pin and B- pin (this is RS-485 on my converter)  I see the data coming out and I can successfully change values like the slave address or start coil and number of coils however when I write 65280 as my data it looks like the USB converter is converting it to dec.

So if I write to the Coils (05) the following data from the Test ModBus window:

SlaveAddr: 1
StartC: 2
NumCoils: 1
Data: FF00

my Data analyzer shows the following:  01 05 00 02 FF 00 2D FA
Which basically looks right however the last 16 bits of the CRC does not  according to the WJ200 manual is 8C A3 but I get 2D FA

Any help would greatly be appreciated or screen captures of what I should be writing with the updated software all the help videos including the ModIO manual use outdated software...
Title: Re: WJ200 low and high range hex frequency data
Post by: cncbaltar on September 16, 2013, 07:21:50 PM
So digging more and more,  Duh CRC is calculated off of the data that is being sent...

So trying values.  When I send the following data:

SlaveAddr: 1
StarC: 0
NumCoils:1
Data: FF00

The following gets transmitted 01 05 00 00 FF 00 8C 3A  just as sinji saw in his early creation of this thread
Stupid manual show the CRC code as 8C A3  I am guessing it is simply a typo, however I still have no functionality over modbus..

The manual definitely appears to be a copy of the X200 manual which really helps nobody...  Sinji or bloomingtonmike I would love to hear from you how you got yours working I just purchased the serial converter that Bloomingtonmike mentioned below hopefully that will resolve my issue if it is simply an incompatibility issue that I have seen from a couple other threads..

I know this is an old thread but I hope somebody out there is still working with WJ200 VFDs with modbus.


Title: Re: WJ200 low and high range hex frequency data
Post by: bloomingtonmike on September 17, 2013, 03:42:05 PM
Hi. Yep still here.

The WJ200 does not use the RJ45 port for modbus - it uses the two pins as noted in the manual. That $5 rs232-to rs485 adapter and a two conductor wire should be all you need.

I have it working via modbus and mach but the brains file needs work to control the 60hz motor I have. You might be fine with a spindle that is 400hz.
Title: Re: WJ200 low and high range hex frequency data
Post by: cncbaltar on September 17, 2013, 04:14:41 PM
Hi. Yep still here.

The WJ200 does not use the RJ45 port for modbus - it uses the two pins as noted in the manual. That $5 rs232-to rs485 adapter and a two conductor wire should be all you need.

I have it working via modbus and mach but the brains file needs work to control the 60hz motor I have. You might be fine with a spindle that is 400hz.

iam NOT using the RJ45 port.. I am using a USB->RS485 (two wire)  I am using it the same way you are can you tell me exactly what you used to test your setup if it is Mach3 what did you type into your data section of the TestModBus window?

Here is how I have mine hooked up:
A+ on USB->RS485 adapter to SP on the Hitachi WJ200
B- on USB->RS485 adapter to SN on Hitachi WJ200
GND on USB->RS485 adapter to GND on Hitachi WJ200
Title: Re: WJ200 low and high range hex frequency data
Post by: bloomingtonmike on September 17, 2013, 04:22:11 PM
You cannot use a USB to RS-485 adapter.
I never used or recommended one.

You need a 9 pin serial RS-232 - RS-485 adapter.

Title: Re: WJ200 low and high range hex frequency data
Post by: cncbaltar on September 17, 2013, 04:31:01 PM
You cannot use a USB to RS-485 adapter.
I never used or recommended one.

You need a 9 pin serial RS-232 - RS-485 adapter.

Sorry I should have been more specific Sinji and several other threads have used USB however nobody seems to respond to those threads.  I realize you used RS232 to RS485.  I will try that today as mine should arrive this afternoon but I would still like to know what you typed into the Test window...

The data formats are not clearly documented ANYWHERE... and it seems only a select few have typed the right thing to see communication.  Maybe my problem is the USB to RS485 converter but I would like to confirm the data itself if possible.
Title: Re: WJ200 low and high range hex frequency data
Post by: bloomingtonmike on September 17, 2013, 07:35:16 PM
Your data will be different than anyone else depending on whats in your registers.

First open the comm - if it says no error you are communicating. Then select holding coils and read 8 of them. You will see their output on the right.

If you have it working and load sinji's brain. Type M3 and you will see the motor start up.

Title: Re: WJ200 low and high range hex frequency data
Post by: cncbaltar on September 18, 2013, 03:34:39 AM
Quote
Your data will be different than anyone else depending on whats in your registers.

Actually maybe you miss understood me I am trying to under stand exactly what you are writing to the WJ200 from Mach3 via Modbus communication.  Lets say turning on/off the spindle which is a single Coil, and I assume On for you is FF00 Off is 0000. 
We are both using a spindle and we are both using the WJ200 and we are both using Mach3   Settings for this should be identical.

Quote
First open the comm - if it says no error you are communicating. Then select holding coils and read 8 of them. You will see their output on the right.

Ok it says no error but all this means is that Mach3 was able to open the comm port which mine says "no error"  But when I try and read or write I get a "time out" error so that means it is not actually reading or writing the data to/from the WJ200.

I have tried BOTH:
USB -> RS485 -> WJ200 via 2 wire interface

RS232 -> RS485 ->WJ200 via 2 wire interface  (I purchased the exact converter you are using and that you linked to in your post)


Basically at this point I am 95% sure that my WJ200 is NOT working via modbus communication.. It does function as expected if I do everything manually with the keypad on the WJ200.

Can you save and post a configuration file of your WJ200 so I can do a file compare to mine?  Maybe I just need to reset everything and start from scratch?

Title: Re: WJ200 low and high range hex frequency data
Post by: tjhanks on January 11, 2014, 04:43:05 PM
Made some progress on the coil writing issue.

From modbus test window if I write to coil 0 this value "FF00" the spindle turns ON and if I write "0" or "0000" the spindle turns OFF.
What I found is that the manual for X200 drive seems to be wrong bacause for X200 I could write "1" and "0" to turn ON and OFF.  The modbus section of both manuals is pretty much the same in fact WJ200 manual has X200 references which shows that the section was copied and edited but not carefully checked.

Anyway, now the question is how do I write FF00 to coil1?
I used the serial port monitor to see what message is going out to the drive when I turn ON the spindle from test window.  That message is:
01 05 00 00 FF 00 8C 3A
and to turn OFF:
01 05 00 00 00 00 CD CA

So from test window function 05 is used to write to the coil.
When I setup modbus and brain to write to the same coil, function 0F is used. This function writes data in consecutive coils vs. 05 which writes data in a single coil.  This might be O.K. but I can't make the value to come up as FF00.  It looks that there is a binary to HEX conversion when writing to modbus, so I tried writing 255 which equals FF in HEX but no luck, I think the message comes out with a value 00 02

An interesting observation is after I write FF00 to turn ON spindle and then read the current value back I actually get 0001


Sinij,
  I read your conversations in this thread, and also on the Yahoo group.  Thanks for putting in good work on this issue and documenting it.

  I just purchased one of Hitachi's new NE-S1 inverters to replace my chinese VFD that blew up.  At any rate, and I'm configuring Modbus control of the spindle, I ran into the same issues you were having with your WJ200, namely that you cannot write a 1 (0001h) to the first couple coils to enable the drive.  I AM able to start my drive by using FF00 as you suggested. This issue, in my opinion, lies with our Inverters.

  I discovered another workaround that doesn't require a complete reworking of the Brains.  I found that if you tried to write 9 or more coils at a time, then you could successfully write a 0001h to start both coils 0 and 1 to start the inverter.  That means there's a very simple fix to make your the brains for an X200 work with either a WJ200 or a NE-S1.  When you configure Modbus in the Serial Plugin section, you can just modify the Run/Direction config to write to 9 coils.  Then your X200 brains will work as intended.

 Screenshot below.

(http://Mach3-SerialModbus-NES1-Config.PNG)
Title: Re: WJ200 low and high range hex frequency data
Post by: tjhanks on January 11, 2014, 04:46:20 PM
One more slight difference between X200 brains and WJ200 and NE-S1 brains is that the frequency resolution is 0.01Hz, so you have to pass 40000 for 400Hz which is 10 times greater than the 4000 you pass for 400Hz on the X200.

  The simple fix is to add a 10* multiplier into your frequency formulas in those brains.