Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Matospeter on November 05, 2011, 09:42:27 PM

Title: Modbus spindle control questions...
Post by: Matospeter on November 05, 2011, 09:42:27 PM
  Okay guys, after quite some time chasing down some Servo faulting issues I finally decided to swap the computer I used to run my mill. This thankfully fixed the fault issues and as a side effect this new computer seems happy to talk to my Teco Sensorless Vector drive.  SO I decided to try to get this thing configured.

    I  have a fellow over on the zone that has the same setup as I do and he managed to get the modbus spindle control configured and he was kind enough to share his brains he wrote for it. I have loaded them into the machine and now I am trying to get the various settings right to allow this to work.  My teco comes with some software called EV link that allows you to configure the RS232 interface with the drive. I could not get this to work with my old computer but the new one was happy to connect and give me the ability to get the drive setup and I was able to turn it on and off and adjust the speed via a virtual control panel on  the computer. SO I know it works and I have communication with the drive.

   Now for what I do not know. The connection is setup on Com1 with 8 data bits, no parity, and 2 stop bits. I enabled modbus control in mach3 and I turned on the spindle control in mach 3 via enabling the spindle. I read where any port and pin address of 0,0 is assumed to be modbus.  I also attempted to configure the modbus and input the same settings he used on the modbus setup page, IE the port, speed, 8N2, and timeout settings.  I then input the dialogue in the blue blocks that determine the commands he used to control the spindle.  The only thing I changed between mine and his is the port address which was different as well as the baud rate.  When I tried to run the modbus test it will read and gives me a return of 0007.  

    In the spindle setup I selected modbus control and have 64 set and I did not know what to put in the Mach3 Max ADC but I input my max spindle speed of 6550 RPM. I selected to enable spindle relays and have them setup as output 2 and 3 for fwd and rev respectively.   I cannot get the machine to turn on the spindle and I am quite sure I am missing something here. Can anyone help me here?  I would appreciate any information you may be able to add.  This spindle control is something I have missed since I went away from relay control and I am anxious to be able to use my Tormach Tension and Compression tapping head again. Thanks in advance and peace

Pete

Title: Re: Modbus spindle control questions...
Post by: Matospeter on November 06, 2011, 04:48:05 PM
Okay guys,
    Twenty some odd views and NO posts is not very helpful. Anyways, This afternoon Richard was kind enough to call me and go over the modbus setup for the spindle and we were able to get the setup to work and output the frequency. It was setup for him which made my max spindle speed less than what it should be but he was able to show me how to adjust the brains to allow this to be changed.  I had most of the setup right but was not aware of how to properly enable the brans he sent me.  Anyways, Now I can turn on the spindle, adjust the speed(after tweaking some settings) and turn it back off. What I still cannot do and he was unable to show me how is to reverse the spindle.  Right now M3 spins the spindle counter clockwise(wrong I think) and M4 does nothing but stops the spindle.  I would be all set if someone would be kind enough to help me setup my TECO jnev-203-h1 Sensorless vector drive to spin in reverse with the brain controls. I can send the brains I have here if necessary. I would LOVE to be back to tapping with my Tormach Tapping head soon. So any help would be most appreciated. Thanks and peace

Pete

Title: Re: Modbus spindle control questions...
Post by: Greolt on November 06, 2011, 05:34:42 PM
Okay guys,
    Twenty some odd views and NO posts is not very helpful.

I viewed your post.  For me to reply saying "I know nothing of TECO VFDs" would not aid you much, don't you think?

A lot of very helpful and knowledgeable folks here but sometimes a little patience might be appropriate.   ;)

Greg
Title: Re: Modbus spindle control questions...
Post by: Matospeter on November 06, 2011, 05:39:04 PM
Thanks Greg!.... ;D :D
Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 06, 2011, 08:15:08 PM
The register on the Teco is a standard 16 bit register that has 16 bit flags.  It can only write and read an interger and can not be used as coils.

Bit 0 = 0 Stop 1= Run
Bit 1 = 0 for Forward and 1 = Reverse

Writing an integer would work.

Spindle ON CW  Write a 1
Spinde ON CCW  Write a 3
Spindle OFF Write a Zero

Also, Pete, it would be helpful if you posted the brain here for people to look at.


Anyone know how to do this?

Richard
Title: Re: Modbus spindle control questions...
Post by: Matospeter on November 06, 2011, 08:23:55 PM
Richard,
   Hey man thanks for that. Perhaps that information is clearer to those who understand this stuff. The brains I offered to post but as you said I am not quite sure how to do that...  I can attatch the files I guess but not sure they would be usable here. Anyone have an idea how to do this?  Peace

Pete
Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 06, 2011, 09:48:55 PM
Just attach the VFDRun.BRN
Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 07, 2011, 07:12:42 AM
Hopefully someone can chime in and help with our Brain logic.  

Modbus - I verified with an external program that I can send the following commands and the VFD acts as expected.

Register 40271 = 1  'VFD Runs in Forward
Register 40271 = 3  'VFD Runs in Reverse
Register 40271 = 0  'VFD Stops

In Mach, Modbus Serial Config -> Test the above also works.

I configured the Modbus Serial Plug In properly because in the VB Editor I can do the following and they all work...

SetModOutput (0,1)  'Forward
SetModOutput (0,3)  'Reverse
SetModOutput (0,0)  'Stop

How I'm trying to do the Brain that is eating my lunch is.....

Spindle CW ON   -> Formula (f)Output = 1 -> Modbus/Address 0, Output,Serial Plugin, Cfg 0
Spindle CCW ON -> Formula (f)Output = 3 -> Modbus/Address 0, Output,Serial Plugin, Cfg 0
The above allows the spindle to run in forward.  Reverse does not work, and turning off the spindle does not work.


I also tried writing to an individual bit, but I read that was broken in brains.
Spindle CW ON   -> No Op -> Modbus/Address 0, Output, Bit Only, Bit 0,Serial Plugin, Cfg 0
Spindle CW ON   -> No Op -> Modbus/Address 0, Output, Bit Only, Bit 1,Serial Plugin, Cfg 0
The above allows forward and stop, however Reverse just stops the spindle.
 
So it appears my logic using formulas does not work as I intended.  I know most of the hard stuff is done and I'm just having a hard time figuring out how to write the brain where it behaves properly.

Any help would be so much appreciated.
Richard



Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 07, 2011, 06:02:05 PM
Heck Greg, Pete and I've been stuck on this for months so it's getting frustrating....
Title: Re: Modbus spindle control questions...
Post by: BR549 on November 07, 2011, 06:22:01 PM
GUYS VERY VERY VERY few people hav evere fooled with a Modbus VFD so there is going to be very little experience on the matter to be shared.

IF you need help with modbus I would contact either Peter Homman(Modio) or Scott Shaffer. They "MAY" be able to help you unwind your mystery

Just a thought(;-) TP
Title: Re: Modbus spindle control questions...
Post by: Greolt on November 08, 2011, 02:22:21 AM
I run a Hitachi via Modbus with brains.

Just forward and speed.   Had reverse going but deleted it because I never run reverse. (router spindle)

But I have not a clue about TECO.  The Hitachi manual is fairly comprehensive.

I have doubts that this will be of any help to you, but here is some info,

http://www.machsupport.com/forum/index.php/topic,17190.msg117422.html#msg117422

Greg
Title: Re: Modbus spindle control questions...
Post by: Matospeter on November 08, 2011, 11:20:31 AM
Okay guys,
    Just thought I would post this here to let you all know that RICHARD AKA RWSKINNER  is a Genius!!  He was able to play with it and got the spindle control COMPLETELY working for my machine. I now have FWD,REV,start, stop, and complete variable speed via mach3 on my mill. I am so totally happy with this as I no longer need to have a bunch of noise catching wires and relays in my control unit anymore. Now I just have the RS232 and everything is nice and neat inside the control unit. The spindle works great and now I can get back to using my TC tapping head and making parts nice and smooth again. Richard you are HUGE!! You are a GIANT among mice!!  I cannot thank you enough for your efforts with this.  He apparently changed the way he was writing the brains and found another way of doing the same thing that is simpler actually to accomplish.  Amazing fellow... Can ya tell that I am pleased and proud of the man?   Geez I thought this would never get done.... haha peace

Pete

Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 08, 2011, 11:31:36 AM
Thanks for the Kudos Pete.
I mainly started from scratch and quit trying to modify all the examples out there.
Brains are checking the status of the Spindle Outputs and sends the proper value to the VFD register.  Easy and Done!!

My main propblem wasn't with the modbus portion,it was understanding how to use the brains.

Richard
Title: Re: Modbus spindle control questions...
Post by: NosmoKing on November 08, 2011, 01:20:40 PM

I mainly started from scratch and quit trying to modify all the examples out there.
Brains are checking the status of the Spindle Outputs and sends the proper value to the VFD register.  Easy and Done!!

Richard

Any chance of a copy??
Nosmo.
Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 08, 2011, 02:43:21 PM
Output5 -> Formula A*1 -> Modbus Register 0
Output6 -> Formula A*3 -> Modbus Register 0

Set Outputs 5 & 6 up for Port 3  (Modbus)
Set outputs 5 & 6 up for Spindle Control

Richard
Title: Re: Modbus spindle control questions...
Post by: NosmoKing on November 08, 2011, 04:25:28 PM
Thanks.
N.
Title: Re: Modbus spindle control questions...
Post by: Hood on November 09, 2011, 06:15:31 AM
Set Outputs 5 & 6 up for Port 3  (Modbus)

Is it definitely port 3?
Modbus is Port 0 when using a PLC but may be different for other applications.
Hood
Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 09, 2011, 06:29:40 AM
That is what I have mine set to.  Really though, I need to experiment because I think it can be any port that is not 1 or 2.
You have to enable them so when M2 and M4 is used mach is enabling the output (in logic)  The brain looks at the outputs logic state and sends a modbus command to the spindle.

Think of a 3 way boolean statement;

If (output5 = 1) then M3
else
If (output6 = 1) then M4
else
M5




Richard
Title: Re: Modbus spindle control questions...
Post by: Hood on November 09, 2011, 06:32:40 AM
Might be best to use Port 0 as Port 3 is used for the SmoothStepper amongst other motion controllers so it may cause issues if you use Port 3 and upgrade at some point.
Hood
Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 09, 2011, 06:37:43 AM
Good Idea, Thanks.
Title: Re: Modbus spindle control questions...
Post by: Matospeter on November 10, 2011, 08:44:36 AM
We actually did have it on port 0 before he got it redone with the new brains.  I have not desires to run a smoothstepper or anything else on this machine other than what is already here as it works great now. The only additions will be a fourth axis as well as other inputs and outputs for a future power drawbar etc...   It is still working great and my settings I have tweaked a bit. It now reverses super fast and I am optimistic my spindle will be able to tap even better than it did before.  I am very pleased...  Now I just gotta finish that power drawbar I was working on. Damn computers, takes me away from what I really want to do...haha peace

Pete

Title: Re: Modbus spindle control questions...
Post by: rwskinner on November 10, 2011, 09:26:50 AM
I moved it over to port 0 on my side and it worked fie and is safer like mentioned.  Since it's really not used from the port or modbus other than looking at logic calls in the brain it doesn't matter other than it may conflict down the road later and cause issues.  Port Zero will not cause any issues later so it's safer.

Richard
Title: Re: Modbus spindle control questions...
Post by: Matospeter on November 10, 2011, 10:54:01 AM
Okay, I will try that, hate to mess with a good thing tho... wish me luck!! peace

Pete

Title: Re: Modbus spindle control questions...
Post by: AETCNC on May 03, 2013, 03:17:40 AM
Hey Guys,

I know this is an old thread, but thought I'd try my luck anyway. I have set up a Schneider Altivar12 (ATV12) VFD over serial modbus. All the on/off and direction and speed control works fine from Mach. However, I have a very erratic system crash...getting Artcode 9991. I have read a lot and this is anything from a divide by zero error (quoted by Art) to anyone knows what else. This erratic crash only happens when I have the spindle switched on with a speed. If I leave it on with zero speed set it will run indefinitely and Mach is stable. Once I have sent the speed to the VFD, it's only a matter of time before a crash.
Everything does work though, so all my inputs and outputs are correct and the brain is correct. Are there any macropumps which I should have ammended to avoid a clash with the brain on Mach cycles?

Any suggestions or help would be much appreciated.

Thanks
Title: Re: Modbus spindle control questions...
Post by: Hood on May 03, 2013, 01:30:16 PM
Dont know what could be the problem but if you attach your Brain maybe I will see something.
Hood
Title: Re: Modbus spindle control questions...
Post by: AETCNC on May 03, 2013, 04:54:35 PM
Hey Hood,

Thanks for the reply. I've actually figured it out. The 9991 error was coming up because I was flooding the Modbus input register.
I hadnt put the pullup resistor between the Tx and Rx lines on the Modbus connection so the line couldnt pull low at the end of a data packet transmit. This caused the registers to overflow. The Modbus CRC was then also not able to work.
All sorted now so I hope this may solve other peoples issues too.

Thanks.
Title: Re: Modbus spindle control questions...
Post by: Hood on May 04, 2013, 02:37:16 AM
Good to hear its sorted and thanks for posting the resolution as it will likely help others :)
Hood